当前位置:网站首页>【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
边栏推荐
- 【蓝桥杯Web】2022年第十三届蓝桥杯Web大学组国赛真题解析
- math_ Use differentiation to calculate approximate value
- Problems encountered in installing MySQL in docker Ubuntu container
- C # joint halcon Application - Dahua Camera Collection class
- 利用QEventLoop实现同步等待槽函数返回
- HLS4ML进入方法
- Getting started with fastdfs
- Process steps of vibrating wire acquisition module for measuring vibrating wire sensor
- Solve the problem of slow or failed vscode download
- Set object value changes null value object
猜你喜欢

Arduino stepper library drive 28byj-48 stepper motor test program

Interview questions shared in today's group

math_ Use differentiation to calculate approximate value

一个悄然崛起的国产软件,低调又强大!

Interview question 1

Hls4ml reports an error the board_ part definition was not found for tul. com. tw:pynq-z2:part0:1.0.

Object creation
![[research materials] iResearch tide Watching: seven major trends in the clothing industry - Download attached](/img/c8/a205ddc2835c87efa38808cf31f59e.jpg)
[research materials] iResearch tide Watching: seven major trends in the clothing industry - Download attached

Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, builds an open source ecological road

开发那些事儿:EasyCVR集群设备管理页面功能展示优化
随机推荐
Swiftui 4 new features complete toggle and mixed toggle multiple binding components
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
数据分析师听起来很高大上?了解这几点你再决定是否转型
【蓝桥杯Web】2022年第十三届蓝桥杯Web大学组国赛真题解析
RichView 文档中的 ITEM
Realize pyramids through JS (asterisk pyramid, palindrome symmetric digital pyramid)
qobject_ Cast usage
3D全景模型展示可视化技术演示
全国职业院校技能大赛网络安全“splunk“详细配置
Arduino stepper library drive 28byj-48 stepper motor test program
[Blue Bridge Cup web] analysis of the real topic of the 13th Blue Bridge Cup web university group match in 2022
[research materials] Huawei Technology ICT 2021: at the beginning of the "Yuan" year, the industry is "new" -- download attached
[AI server setup] CUDA environment
Win11快捷键切换输入法无反应怎么办?快捷键切换输入法没有反应
P2433 [deep foundation 1-2] primary school mathematics n in one
为定时器和延时器等其它情况的回调函数绑定当前作用域的this
math_ Use differentiation to calculate approximate value
[research materials] national second-hand housing market monthly report January 2022 - Download attached
Use Zadig to build a continuous delivery platform from 0 to 1