当前位置:网站首页>【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
边栏推荐
- What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
- EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
- Win11如何取消任务栏隐藏?Win11取消任务栏隐藏的方法
- Problems encountered in installing MySQL in docker Ubuntu container
- RichView RichEdit SRichViewEdit PageSize 页面设置与同步
- List is divided into sets that meet and do not meet conditions (partitioningby)
- Swiftui 4 new features complete toggle and mixed toggle multiple binding components
- GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
- Anaconda installs the virtual environment to the specified path
- fastDFS入门
猜你喜欢

Interesting! Database is also serverless!
![P2433 [deep foundation 1-2] primary school mathematics n in one](/img/28/e5eab8927694ea002b536202a1b5ea.png)
P2433 [deep foundation 1-2] primary school mathematics n in one

RichView RichEdit SRichViewEdit PageSize 页面设置与同步
![[research materials] national second-hand housing market monthly report January 2022 - Download attached](/img/c8/a205ddc2835c87efa38808cf31f59e.jpg)
[research materials] national second-hand housing market monthly report January 2022 - Download attached

Servlet knowledge points

fastDFS入门

SQL getting started plan-1-select

ModSim基本使用(Modbus模拟器)
![[research materials] Huawei Technology ICT 2021: at the beginning of the](/img/83/f21f148103815691796f87a95c687f.jpg)
[research materials] Huawei Technology ICT 2021: at the beginning of the "Yuan" year, the industry is "new" -- download attached

今日群里分享的面试题
随机推荐
HLS4ML报错The board_part definition was not found for tul.com.tw:pynq-z2:part0:1.0.
为定时器和延时器等其它情况的回调函数绑定当前作用域的this
JS的Proxy
Stack overflow 2022 developer survey: where is the industry going?
Cookie和Session的相关概念
人脸识别系统 —— OpenCV人脸检测
Win11怎么关闭开机自启动软件
Process steps of vibrating wire acquisition module for measuring vibrating wire sensor
简单但现代的服务器仪表板Dashdot
How to turn off the boot auto start software in win11
P2433 [deep foundation 1-2] primary school mathematics n in one
C#聯合halcon應用——大華相機采集類
uniapp使用腾讯地图选点 没有window监听回传用户的位置信息,怎么处理
RichView 文档中的 ITEM
STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置
Hls4ml entry method
The large list set is divided into multiple small list sets in equal proportion
What if win11 can't pause the update? Win11 pause update is gray. How to solve it?
Sum the amount
#yyds干货盘点#SQL聚合查询方法总结