Littlombie's Nirvana

Novelty is the great parent of pleasure.


  • Home

  • Archives53

  • Tags31

  • About

  • Nirvana

ES6学习(10)- set-map数据结构

Posted on 2019-08-21 | In ES6

Set的用法

当做数组去用 Set 集合中的元素是不能重复的

1
2
3
4
5
6
7
8
9
10
{
//声明普通的变量
let list = new Set();
//添加两个元素
list.add(5);
list.add(7);

//长度 .size
console.log('size',list.size);//size 2
}
Read more »

ES6学习(9)- Symbol

Posted on 2019-08-21 | In ES6

Symbol 概念

Symbol()声明的变量永远都是独一无二的

1
2
3
4
5
6
7
8
9
{
// 声明
let a1=Symbol();//生成一个独一无二的值
let a2=Symbol();
console.log(a1===a2);//false
let a3=Symbol.for('a3');
let a4=Symbol.for('a3');
console.log(a3===a4);//true
}
Read more »

ES6学习(8)- 对象扩展

Posted on 2019-08-21 | In ES6

简介表示法

注意下列ES5,ES6代码的不同写法

Read more »

ES6学习(7)- 函数扩展

Posted on 2019-08-21 | In ES6

参数默认值

函数参数里边直接赋默认值,但是可以被重新赋值

1
2
3
4
5
6
7
{
function test(x, y = 'world'){
console.log('默认值',x,y);
}
test('hello');
test('hello','kill');
}

Read more »
1234…14
Littlombie

Littlombie

Said less to do more!

53 posts
11 categories
31 tags
RSS
GitHub Weibo Zhihu webSite
Creative Commons
© 2020 Littlombie
Powered by Hexo v3.9.0
|
Theme – NexT.Mist v6.4.2