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
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
Read More:http://es6.ruanyifeng.com/#docs/destructuringArray“模式匹配”,只要等号两边的模式相同,左边的变量就会被赋予对应的值:Exp 1:var [head, ...tail] = [1, 2, 3, 4];console.log(hea...
分类:
其他好文 时间:
2014-11-21 06:53:49
阅读次数:
189
Here is the way you get value from an object:var obj = { color: "blue"}console.log(obj.color); //blueDestructuring Assignment:ObjectDestructuring ...
分类:
其他好文 时间:
2014-11-21 01:31:07
阅读次数:
154
ES6 arrow function is somehow like CoffeeScirpt.CoffeeScript: //function callcoffee = -> coffee()coffee=(messag...
分类:
其他好文 时间:
2014-11-20 06:50:32
阅读次数:
298
Normally, we can set default value for function param://Here use "Hello" as default paramvar receive =function(message="Hello", handle){ handler(me...
分类:
其他好文 时间:
2014-11-20 06:48:53
阅读次数:
185
In ES6, IIFE is not necessary:// IIFE写法(function () { var tmp = ...; ...}());// 块级作用域写法{ let tmp = ...; ...}另外,ES6也规定,函数本身的作用域,在其所在的块级作用域之...
分类:
其他好文 时间:
2014-11-20 01:14:15
阅读次数:
218
var message = "Hi";{ var message = "Bye"; }console.log(message); //ByeThe message inside the block still has impact on the outside.If you add ...
分类:
其他好文 时间:
2014-11-19 23:58:43
阅读次数:
443
Fialdcase 1: let can work in it's block{ let a = 10; var b = 1;}a // ReferenceError: a is not defined.b //1Case 2: Let has no "Hosting" Problemf...
分类:
其他好文 时间:
2014-11-19 23:56:04
阅读次数:
321
首先讲下单例类能够实现的功能,也是在项目中经常可以用到的。因为单例是全局哪里要用直接调用就行非常方便简单,一般我们可以用单例来作对用户信息的存储,其次单例可以做成购物车之类的页面等等。当然单例最大的优势个人感觉就是对数据的存储和读取非常方便,就可以解决页面之间传值困难的问题。简单讲下怎样用单例对数据传输吧,把需要的数据都定义成属性,当需要存储的时候直接调用存储就行,要用的时候把它调出使用就行了这里...
分类:
移动开发 时间:
2014-11-19 18:52:25
阅读次数:
179