当前位置:网站首页>【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
边栏推荐
- Win11暂停更新点不了怎么办?Win11暂停更新是灰色的如何解决?
- Understand the structure in C language in one article
- 简单但现代的服务器仪表板Dashdot
- RichView RichEdit SRichViewEdit PageSize 页面设置与同步
- 写博客文档
- Stack Overflow 2022 开发者调查:行业走向何方?
- 毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
- Use Zadig to build a continuous delivery platform from 0 to 1
- 【无标题】
- 3D全景模型展示可视化技术演示
猜你喜欢
Modsim basic use (Modbus simulator)
数据分析师听起来很高大上?了解这几点你再决定是否转型
Hls4ml entry method
Win11快捷键切换输入法无反应怎么办?快捷键切换输入法没有反应
ModSim基本使用(Modbus模拟器)
math_ Use differentiation to calculate approximate value
math_利用微分算近似值
Arduino Stepper库驱动28BYJ-48步进电机测试程序
cocoaPods 添加成功后,导入不了头文件或者not found file 报错
A quietly rising domestic software, low-key and powerful!
随机推荐
Example explanation: move graph explorer to jupyterlab
Arduino stepper library drive 28byj-48 stepper motor test program
大厂做狼,小厂做狗?
ModSim基本使用(Modbus模拟器)
Leetcode 1380 lucky numbers in matrix [array] the leetcode path of heroding
1592 example 1 King (sgu223 loj10170 luogu1896 increase + / provincial election -) violent thinking pressure DP 01 Backpack
docker ubuntu容器中安装mysql遇到的问题
写博客文档
How to prevent repeated submission of new orders
[AI server setup] CUDA environment
Oracle physical architecture
Win11 how to hide the taskbar? Win11 method to hide the taskbar
强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐
Unreal Engine packaging project
C#聯合halcon應用——大華相機采集類
list分割成满足和不满足条件的集合(partitioningBy)
基于图的 Affinity Propagation 聚类计算公式详解和代码示例
想得到股票开户的优惠链接,如何得知?在线开户是安全么?
EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化
Anaconda安装虚拟环境到指定路径