<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://zhidian.wuute.com/html5dev/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://zhidian.wuute.com/html5dev/feed.php">
        <title>HTML5知典 46:76:f1</title>
        <description></description>
        <link>http://zhidian.wuute.com/html5dev/</link>
        <image rdf:resource="http://zhidian.wuute.com/html5dev/lib/tpl/bootstrap3_1/images/favicon.ico" />
       <dc:date>2026-04-11T20:19:46+09:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/16?rev=1492939698&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/26?rev=1492939723&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/36?rev=1492939742&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/46?rev=1492939760&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/56?rev=1492939801&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/76?rev=1492939860&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/86?rev=1492939894&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/96?rev=1492940065&amp;do=diff"/>
                <rdf:li rdf:resource="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/start?rev=1492940021&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="http://zhidian.wuute.com/html5dev/lib/tpl/bootstrap3_1/images/favicon.ico">
        <title>HTML5知典</title>
        <link>http://zhidian.wuute.com/html5dev/</link>
        <url>http://zhidian.wuute.com/html5dev/lib/tpl/bootstrap3_1/images/favicon.ico</url>
    </image>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/16?rev=1492939698&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:28:18+09:00</dc:date>
        <title>变常量的扩展</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/16?rev=1492939698&amp;do=diff</link>
        <description>变常量的扩展

概述

在ES6中可以使用两个新的命令来声明变量：

	*  const：声明常量
	*  let：声明变量

ES6之前，JavaScript没有块级作用域的概念，而在ES6中const与let声明的变量作用范围仅限于块级区域（ES6引入了块级作用域）。
ES6还引入了一个新的概念TDZ（Temporal Dead Zone，暂存死区）：初始化前的变量或参数不能被访问，也就是说let与const声明的变量直到控制流到达该变量被定义的代码行时才会被装载，而在这之前使用该变量会报错。…</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/26?rev=1492939723&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:28:43+09:00</dc:date>
        <title>字面量的扩展</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/26?rev=1492939723&amp;do=diff</link>
        <description>字面量的扩展

数值

ES6提供了二进制和八进制数值的新的写法，分别用前缀0b和0o表示。

二进制表示法
0b111110111 === 503 // true
八进制表示法
0o767 === 503 // true
字符

Unicode表示法

JavaScript允许采用“\uxxxx”形式表示一个字符，其中“xxxx”表示字符的码点。</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/36?rev=1492939742&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:29:02+09:00</dc:date>
        <title>语句的扩展</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/36?rev=1492939742&amp;do=diff</link>
        <description>语句的扩展

Iterator

Iterator（遍历器）是一种协议，任何对象都可以部署遍历器协议，从而使得for…of循环可以遍历这个对象。

语法
Iterator(object, [keyOnly])
参数

概述

遍历器协议规定，任意对象只要部署了next方法，就可以作为遍历器，但是next方法必须返回一个包含value和done两个属性的对象。其中，value属性当前遍历位置的值，done属性是一个布尔值，表示遍历是否结束。</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/46?rev=1492939760&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:29:20+09:00</dc:date>
        <title>函数的扩展</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/46?rev=1492939760&amp;do=diff</link>
        <description>函数的扩展

ES6增加了很多函数语法糖，使得JavaScript的编写更为简练。

函数参数的默认值

ES6中可以为函数配置默认参数。

示例

示例1


// ES5
var x = 1;
function test(y) { y = y || x; };
// ES6
var x = 1;
function test(y = x) {...};
test();</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/56?rev=1492939801&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:30:01+09:00</dc:date>
        <title>类</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/56?rev=1492939801&amp;do=diff</link>
        <description>类

概述

从功能上讲class更像是新引进的语法糖，而不是字面上理解的基于原型的新继承实现。

定义与实例化

示例


// 定义
class Greet {
  // 构造函数
  constructor (message) {
    this.message = message;
  }
  
  greeting () {
    console.log(this.message);
  }
}
==== 代码说明 ====
  * ES6中的class只包含方法，不包括属性
  * constructor方法是class的默认方法，通过new命令生成实例时，会自动调用该方法
  * 与ES5一样，类的所有实例共享一个原型对象

===== 类继承 =====
==== 示例 ====
&lt;code&gt;
class GreetWithName extends Greet {
  constructor (message, name) {
    super(message);
    this.name = name;
  }
  
  greeting () {
    c…</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/76?rev=1492939860&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:31:00+09:00</dc:date>
        <title>对象的新方法</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/76?rev=1492939860&amp;do=diff</link>
        <description>对象的新方法

Object

Object.is()

Object.is()用来比较两个值是否严格相等。它与严格比较运算符（===）的行为基本一致，不同之处只有两个：一是+0不等于-0，二是NaN等于自身。
+0 === -0 //true
NaN === NaN // false
 
Object.is(+0, -0) // false
Object.is(NaN, NaN) // true</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/86?rev=1492939894&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:31:34+09:00</dc:date>
        <title>新对象的追加</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/86?rev=1492939894&amp;do=diff</link>
        <description>新对象的追加

Symbol

ES6引入了一种新的原始数据类型Symbol，表示独一无二的ID。它通过Symbol函数生成。
let symbol1 = Symbol();
 
typeof symbol
// &quot;symbol&quot;
上面代码中，变量symbol1就是一个独一无二的ID。typeof运算符的结果，表明变量symbol1是Symbol数据类型，而不是字符串之类的其他类型。</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/96?rev=1492940065&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:34:25+09:00</dc:date>
        <title>模板字符串</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/96?rev=1492940065&amp;do=diff</link>
        <description>模板字符串

模板字符串是增强版的字符串，即可以当作普通字符串使用，也可以在字符串中嵌入变量。它用反引号（`）标识。

语法
`string text`
   
`string text line 1
 string text line 2`
   
`string text ${expression} string text`
   
tag `string text ${expression} string text`</description>
    </item>
    <item rdf:about="http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/start?rev=1492940021&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-23T18:33:41+09:00</dc:date>
        <title>ES6新功能</title>
        <link>http://zhidian.wuute.com/html5dev/doku.php/46/76/f1/start?rev=1492940021&amp;do=diff</link>
        <description>ES6新功能

本目录对EcmaScript6的新功能进行说明。

列表

本目录包含以下文档：
f1 index</description>
    </item>
</rdf:RDF>
