当前位置:网站首页>【let var const】
【let var const】
2022-07-01 20:02:00 【Courtesy.】
Block level scope
let and const There are block-level scopes ,var No,
let and const You cannot repeat the description in the same scope ,var Sure
Recommended let
var i=99;
for(let i=0; i<5; i++){
// You cannot use var Declare variables , Use let Statement , because let It has the function of block level scope
// If you are using var Statement , Then the printed results Overall i Will be affected , The output is no longer 99
console.log(i); // Output results : 0 1 2 3 4
}
console.log(i); // Output results : 99
JS File import method : newly build aa.js file , stay html Introduce in the file
<script src="aa.js"></script>
var Meeting Direct change window object , It's not reasonable , When the declared variable is related to window The variables are exactly the same , It will cover window Variable , Make it unable to operate normally and display
var web = "hdcms";
console.log(window.web); // At this time, the printout is hdcms,var Declared variables change global variables , It's not reasonable
let Can't Direct change window object , When the declared variable is related to window The variables are exactly the same , Will not cover window Variable , More recommended
let web = "hdcms";
console.log(window.web); // At this time, the printout is undefine,let Declared variables do not change global variables
Pass value :
let a = 1;
let b = a;
console.log(a,b); //1,1
Byref
let e = { name="a" };
let f = e;
console.log(e,f); // { name="a"} { name="a" }
f.name = "123”;
console.log(e,f); // { name="123"} { name="123" }
null and undefined
Function has no return value , The parameter has no value , Declared no assignment , namely No value is undefined
Background management system : Is based on Vue and elementui Realized , Using the latest front-end technology stack , built-in i18n International solutions , Dynamic routing , Authority verification , Refine a typical business model , Provides a wealth of functional components
Dynamic routing : Left navigation bar , Bread crumbs 、
index.jsion file :children Child routes of (id、 level 、 Sub route name 、 route ), Layer by layer
Vue file : router
Bread crumbs :
<el-breadcrumb-item
:to="{path:'/'}"
v-for="item in breadcrumbList"
:key="item.path"
>
{
{
item.meta.title}}
</el-breadcrumb-item >
<router-view></router-view>
......
computed{
breadcrumbList(){
return this.$route.matched
}
}
v-for loop , And click to trigger
<div
v-for="item in list"
:key="item.title"
>
{
{
item.title}}
</div>
return{
list:[
{
title:'A'},
{
title:'B'},
{
title:'C'},
{
title:'D'}
]
}
methods:{
handClick({
title}){
switch(title){
case 'A':
console.log(' I am a A');
break
case 'B':
console.log(' I am a B');
break
case 'C':
console.log(' I am a C');
break
case 'D':
console.log(' I am a D');
break
}
}
}
Interpolation expression : { { flag ? ‘yes’ : ‘no’ }} data It defines flag The default is false
watch Listener attribute
What is a callback function ?
recursive ?
keyword this?
Arrow function ? Simplify writing
Closure ? The child function accesses the parent function
Shake proof . throttle
边栏推荐
猜你喜欢
Class loading mechanism
[AI server setup] CUDA environment
[untitled]
由浅入深学会白盒测试用例设计
[research data] observation on the differences of health preservation concepts among people in 2022 - Download attached
再回顾集合容器
GC garbage collection
全国职业院校技能大赛网络安全“splunk“详细配置
P2433 [deep foundation 1-2] primary school mathematics n in one
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
随机推荐
EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化
强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐
February 15, 2022: sweeping robot. There is a floor sweeping robot in the room (represented by a grid). Each grid in the grid has two possibilities: empty and obstacles. The sweeping robot provides fo
Summary of SQL aggregate query method for yyds dry goods inventory
What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
SwiftUI 4 新功能大全之 Toggle与 Mixed Toggle 多个绑定组件
tensorflow报错Could not load dynamic library ‘libcudnn.so.8
Cookie和Session的相关概念
How to add transactions in JDBC
Servlet knowledge points
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
JS的Proxy
SQL 入门计划-1-选择
Anaconda installs the virtual environment to the specified path
How to use console Log print text?
Solve the problem of slow or failed vscode download
Linux下安装Redis,并配置环境
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
Install redis under Linux and configure the environment
有意思了!数据库也搞Serverless!