码迷,mamicode.com
首页 >  
搜索关键字:es6    ( 5574个结果
[ES6] 18. Map
ES6 provides Map, it is a set of k-v pair. Key can be number, string, object, function and even undefined.var m = new Map();Methods:1. set(k,v)m.set("...
分类:其他好文   时间:2015-01-02 06:29:26    阅读次数:167
[ES6] 19. for ... of
In ES5, we have for ... in:var phones = ["iPhone", "Nexus", "Nokia"];for(i in phones){ console.log(phones[i]);}//iPhone//Nexus//NokiaWhat we get fr...
分类:其他好文   时间:2015-01-02 06:26:05    阅读次数:160
[ES6] 16. Object Enhancements
Define object:var color = "blue";var speed = 120;var car = {color, speed};console.log(car.color); // blueconsole.log(car.speed); // 120in ES5:var ca.....
分类:其他好文   时间:2015-01-01 22:27:54    阅读次数:251
JS篇 ES6新特性
注意:1. Node环境下,--harmony参数启用ES6新特性,许多新特性只有在strict mode下才生效,因此使用"use strict"或者--use_strict,否则harmony没有被启用;1. 块级作用域(Block scope)// Block scopefunction f1...
分类:Web程序   时间:2014-12-28 18:06:24    阅读次数:188
JS魔法堂:ES6新特性——GeneratorFunction介绍
一、前言 第一次看koajs的示例时,发现该语句 function *(next){...............} ,这是啥啊?于是搜索一下,原来这是就是ES6的新特性Generator Function(生成器函数)。 那什么是生成器函数呢...
分类:Web程序   时间:2014-12-17 01:33:33    阅读次数:255
ECMAScript6学习之三
1、展开运算符(spread(...)operator)以前我们把某一个方法作为某一个对象的方法调用时,方法如下:functionecma(x,y,z){ alert(‘x:‘+x+",y="+y+‘,z=‘+z); } varargs=[0,1,2]; ecma.apply(null,args); 有了ECMAScript6就可以变成如下形式了,functionecma(x,y,z){ alert(‘x:..
分类:其他好文   时间:2014-11-28 18:27:52    阅读次数:204
[ES6] 14. Generator -- 1. yield & next()
Generators in ECMAscript 6 are first-class coroutines that produce encapsulated suspended execution(暂停执行) contexts.Yield values and iterate over them ...
分类:其他好文   时间:2014-11-23 21:41:42    阅读次数:266
[ES6] 13. Using the ES6 spread operator ...
The spread operator (...) allows you to "explode" an array into its individual elements.Spreate an array:console.log([1,2,3]); // [1, 2, 3] conso...
分类:其他好文   时间:2014-11-23 01:55:10    阅读次数:228
[ES6] 12. Shorthand Properties in ES6
Where destructuring in ES6 allows you to easily get properties out of an object, this shorthand property syntax allows you to easily push properties i...
分类:其他好文   时间:2014-11-23 01:53:42    阅读次数:182
[ES6] 11. String Templates
ECMAscript 6 lets us use string templates to gain a lot more control over strings in JavaScript.var salutation = "Hello";var place = "New York";var gr...
分类:其他好文   时间:2014-11-22 20:09:05    阅读次数:162
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!