quoniammm / es6_7study Goto Github PK
View Code? Open in Web Editor NEWThis is a repo about es6 and es7.
License: MIT License
This is a repo about es6 and es7.
License: MIT License
//************eg1*************//
//===============执行结果为6=======================//
/*
'use strict'
var a = [];
for (let i = 0; i < 10; i++) {
a[i] = function () {
console.log(i);
};
}
*/
//================执行结果为10====================//
/*
let i = 0;
while(i < 10){
a[i] = function(){
console.log(i);
}
i ++;
}
*/
//==============执行的语句:a[6]();=======================//
//************eg2*************//
/*
function f() { console.log('I am outside!'); }
(function () {
if(false) {
// 重复声明一次函数f
function f() { console.log('I am inside!'); }
}
f();
}());
*/
//================ES5: I am inside! =================//
//================ES6: I am outside! ================//
//================执行的语句:f() ==================//
//let没有var所谓的‘变量提升’,let的作用域为代码块,代码块之外无法访问 <eg1>
//补充
/*
=1.暂时性死域
=2.不允许重复声明
=3.块级作用域,ES5的时候只有函数作用域,避免了内层变量可能会覆盖外层变量,用来计数的循环变量泄露为全局变量
=4.块级作用域的出现,实际上使得获得广泛应用的立即执行匿名函数(IIFE)不再必要了。
=5.ES6也规定,函数本身的作用域,在其所在的块级作用域之内。<eg2>
=6.const也用来声明变量,但是声明的是常量。一旦声明,常量的值就不能改变,作用域规则与let相同。
=7.对于复合类型的变量,变量名不指向数据,而是指向数据所在的地址。const命令只是保证变量名指向的地址不变,
并不保证该地址的数据不变,所以将一个对象声明为常量必须非常小心。
*/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.