lamp9 2017-07-13 09:52:07 67次浏览 0条回复 0 0 0

建表语句:
CREATE TABLE logs_work (
id int(11) NOT NULL AUTO_INCREMENT,
uid int(11) NOT NULL,
title char(100) NOT NULL DEFAULT 'title',
time int(11) NOT NULL DEFAULT '0',
content longtext NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4;

错误信息:
Exception (Database Exception) 'yii\db\Exception' with message 'SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'content' at row 1
The SQL being executed was: INSERT INTO log_admin (log_type, log_time, title, content, member_id, url, url_referer) VALUES ('LogsWork', 1499909351, 'UpdateID:36;管理员:1/root', '{\"id\":36,\"uid\":1,\"title\":\"2017-07-14\",\"time\":1500023976,\"content\":\"\u524d\u7aef \u2013 ECMAScript \u65b0\u529f\u80fd\r\n\u4f5c\u7528\u57df\r\n \u8bfe\u7a0b\u4ecb\u7ecd \u2013 ECMAScript \u65b0\u529f\u80fd\r\n \u5757\u4f5c\u7528\u57df \u2013 let\r\n \u4ee5\u524d\u7684JS\u53ea\u6709\u5168\u5c40\u4f5c\u7528\u57df\u548c\u51fd\u6570\u4f5c\u7528\u57df,\u73b0\u5728JS\u4e5f\u6709\u4e86\u5757\u7ea7\u4f5c\u7528\u57df\r\n \u2018use strict\u2019;\r\n if(true){\r\n var fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\r\n \u2018use strict\u2019;\r\n if(true){\r\n let fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\/\/\u62a5\u9519\r\n \u6052\u91cf \u2013 const\r\n const fruit = \u2018apple\u2019;\r\n console.log(fruit);\r\n const fruit = \u2018orange\u2019;\/\/\u62a5\u9519\r\n console.log(fruit);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n const fruit = [];\r\n fruit.push(\u2018apple\u2019);\r\n fruit.push(\u2018orange\u2019);\r\n fruit = [];\/\/\u62a5\u9519\r\n console.log(fruit);\r\n\u89e3\u6784\r\n \u89e3\u6784\u6570\u7ec4 \u2013 Array Destructuring\r\n \u89e3\u6784\u662fES6\u91cc\u65b0\u7684\u8bed\u6cd5,\u610f\u601d\u662f\u5206\u89e3\u4e00\u4e2a\u4e1c\u897f\u7684\u7ed3\u6784\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return [\\u2018apple\\u2019, \\u2018orange\\u2019, \\u2018banana\\u2019];\r\n }\r\n var tmp = breakfast(), a = tmp[0], b = tmp[1], c = tmp[1];\r\n let [e, f, g] = breakfast();\r\n console.log(a, b, c, e, f, g);\r\n \u89e3\u6784\u5bf9\u8c61 \u2013 Object Destructuring\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return {dessert: \u2018cake\u2019, drink: \u2018tea\u2019, fruit: \u2018apple\u2019};\r\n }\r\n let {dessert: de, drink: dr, fruit: fr} = breakfast();\r\n console.log(de, dr, fr);\r\n\u5b57\u7b26\u4e32\u6a21\u677f\r\n \u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Template Strings\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = \\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast);\r\n \u5e26\u6807\u7b7e\u7684\u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Tagged Templates\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n function kitchen(strings, \u2026values){\r\n \/\/console.log(strings);\r\n \/\/console.log(values);\r\n let result = \u201d;\r\n for(var i = 0; i < values.length; i++){\r\n result += strings[i];\r\n result += values[i];\r\n }\r\n result += strings[strings.length -1];\r\n return result;\r\n }\r\n console.log(breakfast);\r\n \u5224\u65ad\u5b57\u7b26\u4e32\u91cc\u662f\u5426\u5305\u542b\u5176\u5b83\u7684\u5b57\u7b26\u4e32\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast.startsWith(\u2018\u4eca\u5929\u2019));\r\n console.log(breakfast.endsWith(\u2018!\u2019));\r\n console.log(breakfast.includes(\u2018\u4eca\u5929\u2019));\r\n\u51fd\u6570\r\n \u9ed8\u8ba4\u53c2\u6570 \u2013 Default Parameter Values\r\n \u2018use strict\u2019;\r\n function breakfast (dessert = \u2018cake\u2019, drink = \u2018tea\u2019){\r\n return ${dessert} ${drink};\r\n }\r\n console.log(breakfast());\r\n console.log(breakfast(\u2018A\u2019, \u2018B\u2019));\r\n \u5c55\u5f00\u64cd\u4f5c\u7b26- Spread\r\n \u2018use strict\u2019;\r\n let fruits = [\\u2018apple\\u2019, \\u2018banana\\u2019],\r\n foods = [\\u2018cake\\u2019, \\u2026fruits];\r\n console.log(fruits);\r\n console.log(\u2026fruits);\r\n console.log(foods);\r\n \u5269\u4f59\u64cd\u4f5c\u7b26 \u2013 Rest\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, \u2026foods){\r\n console.log(dessert, drink, foods);\r\n console.log(dessert, drink, \u2026foods);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, \u2018apple\u2019, \u2018banana\u2019);\r\n \u89e3\u6784\u53c2\u6570 \u2013 Destructured Parameters\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, {location, restaurant} = {}){\r\n console.log(dessert, drink, location, restaurant);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, {location: \u2018china\u2019, restaurant: \u2018chinese foods\u2019});\r\n \u51fd\u6570\u7684\u540d\u5b57 \u2013 name \u5c5e\u6027\r\n \u2018use strict\u2019;\r\n let breakfast = function(argument){\r\n }\r\n console.log(breakfast.name);\r\n let breakfast = function superBreakfast(argument){\r\n }\r\n console.log(breakfast.name);\r\n \u7bad\u5934\u51fd\u6570 \u2013 Arrow Functions\r\n \u2018use strict\u2019;\r\n let breakfast = dessert => dessert;\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n babel script.js \u2013watch \u2013out-file script-compiled.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n \u2018use strict\u2019;\r\n var breakfast = function breakfast(dessert){\r\n return dessert;\r\n }\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n let breakfast = (dessert, drink) => dessert + drink;\r\n let breakfast = (dessert, drink) => {\r\n return dessert + drink;\r\n };\r\n\u5bf9\u8c61\r\n \u5bf9\u8c61\u8868\u8fbe\u5f0f\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let food = {\r\n dessert: dessert,\r\n drink: drink,\r\n };\r\n console.log(food);\r\n let food = {\r\n dessert,\r\n drink,\r\n breakfast(){\r\n }\r\n };\r\n console.log(food);\r\n \u5bf9\u8c61\u5c5e\u6027\u540d\r\n \u2018use strict\u2019;\r\n let food = {};\r\n let drink = \u2018hot drink\u2019;\r\n food.dessert = \u2018cake\u2019;\r\n food[\\u2018hot drink\\u2019] = \u2018tea\u2019;\r\n food[drink] = \u2018tea\u2019;\r\n console.log(food);\r\n \u5bf9\u6bd4\u4e24\u4e2a\u503c\u662f\u5426\u76f8\u7b49 \u2013 Object.is()\r\n \u2018use strict\u2019;\r\n > +0 == -0\r\n true\r\n > +0 === -0\r\n true\r\n > NaN == NaN\r\n false\r\n > Object.is(NaN, NaN)\r\n true\r\n Object.is(+0, -0)\r\n false\r\n \u628a\u5bf9\u8c61\u7684\u503c\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5bf9\u8c61\u91cc \u2013 Object.assign()\r\n \u2018use strict\u2019;\r\n let breakfast = {};\r\n Object.assign(\r\n breakfast,\r\n {drink: \u2018beer\u2019},\r\n {drink: \u2018tea\u2019}\r\n );\r\n console.log(breakfast);\r\n \u8bbe\u7f6e\u5bf9\u8c61\u7684 prototype \u2013 Object.setPrototypeOf()\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = Object.create(breakfast);\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === breakfast);\r\n Object.setPrototypeOf(sunday, dinner);\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === dinner);\r\n proto\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = {proto: breakfast};\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === breakfast);\r\n sunday.proto = dinner;\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === dinner);\r\n super\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = {\r\n proto: breakfast\r\n getDrink(){\r\n return super.getDrink() + \u2018 + beer\u2019;\r\n }\r\n };\r\n console.log(sunday.getDrink());\r\n\u751f\u6210\u5668\u4e0e\u8fed\u4ee3\u5668\r\n \u8fed\u4ee3\u5668 \u2013 Iterators\r\n \u8fd4\u56de\u503c: {value: xx, done: true\/false}\r\n \u2018use strict\u2019;\r\n function chef(foods){\r\n let i = 0;\r\n return {\r\n next(){\r\n let done = (i >= foods.length);\r\n let value = !done ? foods[i++] : undefined;\r\n return {\r\n value: value,\r\n done: done\r\n }\r\n }\r\n }\r\n }\r\n let lamp9 = chef([\\u2018egg\\u2019, \\u2018potato\\u2019]);\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n \u751f\u6210\u5668 \u2013 Generators\r\n \u2018use strict\u2019;\r\n function chef(){\r\n yield \u2018egg\u2019;\r\n yield \u2018potato\u2019;\r\n }\r\n let lamp9 = chef();\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n \/function chef(foods){\r\n for(var i = 0; i < foods.length; i++){\r\n yield foods[i];\r\n }\r\n }\/\r\n let chef = function (foods){\r\n for(var i = 0; i < foods.length; i++){\r\n yield foods[i];\r\n }\r\n }\r\n let lamp9 = chef([\\u2018egg\\u2019, \\u2018potato\\u2019]);\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n\u7c7b\r\n Classes \u2013 \u7c7b\r\n \u2018use strict\u2019;\r\n class Chef{\r\n constructor(food){\r\n this.food = food;\r\n }\r\n cook(){\r\n console.log(this.food);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018egg\u2019);\r\n lamp9.cook();\r\n get \u4e0e set\r\n \u2018use strict\u2019;\r\n class Chef{\r\n constructor(food){\r\n this.food = food;\r\n this.dish [];\r\n }\r\n get menu(){\r\n return this.dish;\r\n }\r\n set menu(dish){\r\n this.dish.push(dish);\r\n }\r\n cook(){\r\n console.log(this.food);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018egg\u2019);\r\n console.log(lamp9.menu = \u2018cake\u2019);\r\n console.log(lamp9.menu = \u2018tea\u2019);\r\n console.log(lamp9.menu);\r\n \u9759\u6001\u65b9\u6cd5 \u2013 static\r\n \u2018use strict\u2019;\r\n class Chef{\r\n \/\/\u2026.\r\n static cook(food){\r\n console.log(this.food);\r\n }\r\n }\r\n Chef.cook(\u2018cake\u2019);\r\n \u7ee7\u627f \u2013 extends\r\n \u2018use strict\u2019;\r\n class Person{\r\n constructor(name, brithday){\r\n this.name = name;\r\n this.birthday = birthday;\r\n }\r\n intro(){\r\n return ${this.name}, $this.birthday;\r\n }\r\n }\r\n class Chef extends Person{\r\n constructor(name, birthday){\r\n super(name, birthday);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018lamp9\u2019, \u20181999-09-09\u2019);\r\n console.log(lamp9.intro());\r\n\u96c6\u5408\r\n Set:\u4e0d\u80fd\u6709\u91cd\u590d\u7684\u5185\u5bb9\r\n \u2018use strict\u2019;\r\n let desserts = new Set(\u2018123\u2019);\r\n desserts.add(\u20184\u2019);\r\n desserts.add(\u20184\u2019);\r\n console.log(desserts);\r\n console.log(desserts.size);\r\n console.log(desserts.has(\u20181\u2019));\r\n desserts.delete(\u20181\u2019);\r\n console.log(desserts);\r\n desserts.forEach(dessert=> {\r\n console.log(dessert);\r\n });\r\n desserts.clear();\r\n console.log(desserts);\r\n Map\r\n \u2018use strict\u2019;\r\n let food = new Map();\r\n let fruit = {}, cook = function(){}, dessert = \u2018\u751c\u70b9\u2019;\r\n food.set(fruit, \u2018apple\u2019);\r\n food.set(cook, \u2018egg\u2019);\r\n food.set(dessert, \u2018cake\u2019);\r\n console.log(food);\r\n console.log(food.size);\r\n console.log(food.get(fruit));\r\n console.log(food.get(cooke));\r\n food.delete(dessert);\r\n console.log(food.has(dessert));\r\n food.forEach((value, key) => {\r\n console.log(${key} = ${value});\r\n });\r\n food.clear();\r\n console.log(food);\r\n\u6a21\u5757\r\n Modules \u2013 \u6a21\u5757\r\n as chef from \u2018.\/modules\/chef\u2019;\r\n console.log(chef.fruit, chef.dessert);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u91cd\u547d\u540d\u5bfc\u51fa\u4e0e\u5bfc\u5165\u7684\u4e1c\u897f\r\n chef.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014-\r\n \u2018use strict\u2019;\r\n let fruit = \u2018apple\u2019;\r\n let dessert = \u2018cake\u2019;\r\n function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\r\n export {fruit, dessert, dinner as supper};\r\n \u2014\u2014\u2014\u2014\u2014\u2013\r\n script.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u2018use strict\u2019;\r\n import {fruit, dessert, supper as dinner} from \u2018.\/modules\/chef\u2019;\r\n dinner(fruit, dessert);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u5bfc\u51fa\u4e0e\u5bfc\u5165\u9ed8\u8ba4\r\n chef.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014-\r\n \u2018use strict\u2019;\r\n let fruit = \u2018apple\u2019;\r\n let dessert = \u2018cake\u2019;\r\n \/export default function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\/\r\n function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\r\n export {dinner as default};\r\n \u2014\u2014\u2014\u2014\u2014\u2013\r\n script.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u2018use strict\u2019;\r\n import chef from \u2018.\/modules\/chef\u2019;\r\n chef(\u2018apple\u2019, \u2018cake\u2019);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u524d\u7aef \u2013 ECMAScript \u65b0\u529f\u80fd\r\n\u4f5c\u7528\u57df\r\n \u8bfe\u7a0b\u4ecb\u7ecd \u2013 ECMAScript \u65b0\u529f\u80fd\r\n \u5757\u4f5c\u7528\u57df \u2013 let\r\n \u4ee5\u524d\u7684JS\u53ea\u6709\u5168\u5c40\u4f5c\u7528\u57df\u548c\u51fd\u6570\u4f5c\u7528\u57df,\u73b0\u5728JS\u4e5f\u6709\u4e86\u5757\u7ea7\u4f5c\u7528\u57df\r\n \u2018use strict\u2019;\r\n if(true){\r\n var fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\r\n \u2018use strict\u2019;\r\n if(true){\r\n let fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\/\/\u62a5\u9519\r\n \u6052\u91cf \u2013 const\r\n const fruit = \u2018apple\u2019;\r\n console.log(fruit);\r\n const fruit = \u2018orange\u2019;\/\/\u62a5\u9519\r\n console.log(fruit);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n const fruit = [];\r\n fruit.push(\u2018apple\u2019);\r\n fruit.push(\u2018orange\u2019);\r\n fruit = [];\/\/\u62a5\u9519\r\n console.log(fruit);\r\n\u89e3\u6784\r\n \u89e3\u6784\u6570\u7ec4 \u2013 Array Destructuring\r\n \u89e3\u6784\u662fES6\u91cc\u65b0\u7684\u8bed\u6cd5,\u610f\u601d\u662f\u5206\u89e3\u4e00\u4e2a\u4e1c\u897f\u7684\u7ed3\u6784\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return [\\u2018apple\\u2019, \\u2018orange\\u2019, \\u2018banana\\u2019];\r\n }\r\n var tmp = breakfast(), a = tmp[0], b = tmp[1], c = tmp[1];\r\n let [e, f, g] = breakfast();\r\n console.log(a, b, c, e, f, g);\r\n \u89e3\u6784\u5bf9\u8c61 \u2013 Object Destructuring\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return {dessert: \u2018cake\u2019, drink: \u2018tea\u2019, fruit: \u2018apple\u2019};\r\n }\r\n let {dessert: de, drink: dr, fruit: fr} = breakfast();\r\n console.log(de, dr, fr);\r\n\u5b57\u7b26\u4e32\u6a21\u677f\r\n \u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Template Strings\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = \\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast);\r\n \u5e26\u6807\u7b7e\u7684\u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Tagged Templates\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n function kitchen(strings, \u2026values){\r\n \/\/console.log(strings);\r\n \/\/console.log(values);\r\n let result = \u201d;\r\n for(var i = 0; i < values.length; i++){\r\n result += strings[i];\r\n result += values[i];\r\n }\r\n result += strings[strings.length -1];\r\n return result;\r\n }\r\n console.log(breakfast);\r\n \u5224\u65ad\u5b57\u7b26\u4e32\u91cc\u662f\u5426\u5305\u542b\u5176\u5b83\u7684\u5b57\u7b26\u4e32\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast.startsWith(\u2018\u4eca\u5929\u2019));\r\n console.log(breakfast.endsWith(\u2018!\u2019));\r\n console.log(breakfast.includes(\u2018\u4eca\u5929\u2019));\r\n\u51fd\u6570\r\n \u9ed8\u8ba4\u53c2\u6570 \u2013 Default Parameter Values\r\n \u2018use strict\u2019;\r\n function breakfast (dessert = \u2018cake\u2019, drink = \u2018tea\u2019){\r\n return ${dessert} ${drink};\r\n }\r\n console.log(breakfast());\r\n console.log(breakfast(\u2018A\u2019, \u2018B\u2019));\r\n \u5c55\u5f00\u64cd\u4f5c\u7b26- Spread\r\n \u2018use strict\u2019;\r\n let fruits = [\\u2018apple\\u2019, \\u2018banana\\u2019],\r\n foods = [\\u2018cake\\u2019, \\u2026fruits];\r\n console.log(fruits);\r\n console.log(\u2026fruits);\r\n console.log(foods);\r\n \u5269\u4f59\u64cd\u4f5c\u7b26 \u2013 Rest\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, \u2026foods){\r\n console.log(dessert, drink, foods);\r\n console.log(dessert, drink, \u2026foods);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, \u2018apple\u2019, \u2018banana\u2019);\r\n \u89e3\u6784\u53c2\u6570 \u2013 Destructured Parameters\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, {location, restaurant} = {}){\r\n console.log(dessert, drink, location, restaurant);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, {location: \u2018china\u2019, restaurant: \u2018chinese foods\u2019});\r\n \u51fd\u6570\u7684\u540d\u5b57 \u2013 name \u5c5e\u6027\r\n \u2018use strict\u2019;\r\n let breakfast = function(argument){\r\n }\r\n console.log(breakfast.name);\r\n let breakfast = function superBreakfast(argument){\r\n }\r\n console.log(breakfast.name);\r\n \u7bad\u5934\u51fd\u6570 \u2013 Arrow Functions\r\n \u2018use strict\u2019;\r\n let breakfast = dessert => dessert;\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n babel script.js \u2013watch \u2013out-file script-compiled.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n \u2018use strict\u2019;\r\n var breakfast = function breakfast(dessert){\r\n return dessert;\r\n }\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n let breakfast = (dessert, drink) => dessert + drink;\r\n let breakfast = (dessert, drink) => {\r\n return dessert + drink;\r\n };\r\n\u5bf9\u8c61\r\n \u5bf9\u8c61\u8868\u8fbe\u5f0f\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let food = {\r\n dessert: dessert,\r\n drink: drink,\r\n };\r\n console.log(food);\r\n let food = {\r\n dessert,\r\n drink,\r\n breakfast(){\r\n }\r\n };\r\n console.log(food);\r\n \u5bf9\u8c61\u5c5e\u6027\u540d\r\n \u2018use strict\u2019;\r\n let food = {};\r\n let drink = \u2018hot drink\u2019;\r\n food.dessert = \u2018cake\u2019;\r\n food[\\u2018hot drink\\u2019] = \u2018tea\u2019;\r\n food[drink] = \u2018tea\u2019;\r\n console.log(food);\r\n \u5bf9\u6bd4\u4e24\u4e2a\u503c\u662f\u5426\u76f8\u7b49 \u2013 Object.is()\r\n \u2018use strict\u2019;\r\n > +0 == -0\r\n true\r\n > +0 === -0\r\n true\r\n > NaN == NaN\r\n false\r\n > Object.is(NaN, NaN)\r\n true\r\n Object.is(+0, -0)\r\n false\r\n \u628a\u5bf9\u8c61\u7684\u503c\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5bf9\u8c61\u91cc \u2013 Object.assign()\r\n \u2018use strict\u2019;\r\n let breakfast = {};\r\n Object.assign(\r\n breakfast,\r\n {drink: \u2018beer\u2019},\r\n {drink: \u2018tea\u2019}\r\n );\r\n console.log(breakfast);\r\n \u8bbe\u7f6e\u5bf9\u8c61\u7684 prototype \u2013 Object.setPrototypeOf()\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = Object.create(breakfast);\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === breakfast);\r\n Object.setPrototypeOf(sunday, dinner);\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === dinner);\r\n proto\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = {proto: breakfast};\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === breakfast);\r\n sunday.proto = dinner;\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === dinner);\r\n super\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = {\r\n proto: breakfast\r\n getDrink(){\r\n return super.getDrink() + \u2018 + beer\u2019;\r\n }\r\n };\r\n console.log(sunday.getDrink());\r\n\u751f\u6210\u5668\u4e0e\u8fed\u4ee3\u5668\r\n \u8fed\u4ee3\u5668 \u2013 Iterators\r\n \u8fd4\u56de\u503c: {value: xx, done: true\/false}\r\n \u2018use strict\u2019;\r\n function chef(foods){\r\n let i = 0;\r\n return {\r\n next(){\r\n let done = (i >= foods.length);\r\n let value = !done ? foods[i++] : undefined;\r\n return {\r\n value: value,\r\n done: done\r\n }\r\n }\r\n }\r\n }\r\n let lamp9 = chef([\\u2018egg\\u2019, \\u2018potato\\u2019]);\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n \u751f\u6210\u5668 \u2013 Generators\r\n \u2018use strict\u2019;\r\n function chef(){\r\n yield \u2018egg\u2019;\r\n yield \u2018potato\u2019;\r\n }\r\n let lamp9 = chef();\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n \/function chef(foods){\r\n for(var i = 0; i < foods.length; i++){\r\n yield foods[i];\r\n }\r\n }\/\r\n let chef = function (foods){\r\n for(var i = 0; i < foods.length; i++){\r\n yield foods[i];\r\n }\r\n }\r\n let lamp9 = chef([\\u2018egg\\u2019, \\u2018potato\\u2019]);\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n\u7c7b\r\n Classes \u2013 \u7c7b\r\n \u2018use strict\u2019;\r\n class Chef{\r\n constructor(food){\r\n this.food = food;\r\n }\r\n cook(){\r\n console.log(this.food);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018egg\u2019);\r\n lamp9.cook();\r\n get \u4e0e set\r\n \u2018use strict\u2019;\r\n class Chef{\r\n constructor(food){\r\n this.food = food;\r\n this.dish [];\r\n }\r\n get menu(){\r\n return this.dish;\r\n }\r\n set menu(dish){\r\n this.dish.push(dish);\r\n }\r\n cook(){\r\n console.log(this.food);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018egg\u2019);\r\n console.log(lamp9.menu = \u2018cake\u2019);\r\n console.log(lamp9.menu = \u2018tea\u2019);\r\n console.log(lamp9.menu);\r\n \u9759\u6001\u65b9\u6cd5 \u2013 static\r\n \u2018use strict\u2019;\r\n class Chef{\r\n \/\/\u2026.\r\n static cook(food){\r\n console.log(this.food);\r\n }\r\n }\r\n Chef.cook(\u2018cake\u2019);\r\n \u7ee7\u627f \u2013 extends\r\n \u2018use strict\u2019;\r\n class Person{\r\n constructor(name, brithday){\r\n this.name = name;\r\n this.birthday = birthday;\r\n }\r\n intro(){\r\n return ${this.name}, $this.birthday;\r\n }\r\n }\r\n class Chef extends Person{\r\n constructor(name, birthday){\r\n super(name, birthday);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018lamp9\u2019, \u20181999-09-09\u2019);\r\n console.log(lamp9.intro());\r\n\u96c6\u5408\r\n Set:\u4e0d\u80fd\u6709\u91cd\u590d\u7684\u5185\u5bb9\r\n \u2018use strict\u2019;\r\n let desserts = new Set(\u2018123\u2019);\r\n desserts.add(\u20184\u2019);\r\n desserts.add(\u20184\u2019);\r\n console.log(desserts);\r\n console.log(desserts.size);\r\n console.log(desserts.has(\u20181\u2019));\r\n desserts.delete(\u20181\u2019);\r\n console.log(desserts);\r\n desserts.forEach(dessert=> {\r\n console.log(dessert);\r\n });\r\n desserts.clear();\r\n console.log(desserts);\r\n Map\r\n \u2018use strict\u2019;\r\n let food = new Map();\r\n let fruit = {}, cook = function(){}, dessert = \u2018\u751c\u70b9\u2019;\r\n food.set(fruit, \u2018apple\u2019);\r\n food.set(cook, \u2018egg\u2019);\r\n food.set(dessert, \u2018cake\u2019);\r\n console.log(food);\r\n console.log(food.size);\r\n console.log(food.get(fruit));\r\n console.log(food.get(cooke));\r\n food.delete(dessert);\r\n console.log(food.has(dessert));\r\n food.forEach((value, key) => {\r\n console.log(${key} = ${value});\r\n });\r\n food.clear();\r\n console.log(food);\r\n\u6a21\u5757\r\n Modules \u2013 \u6a21\u5757\r\n as chef from \u2018.\/modules\/chef\u2019;\r\n console.log(chef.fruit, chef.dessert);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u91cd\u547d\u540d\u5bfc\u51fa\u4e0e\u5bfc\u5165\u7684\u4e1c\u897f\r\n chef.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014-\r\n \u2018use strict\u2019;\r\n let fruit = \u2018apple\u2019;\r\n let dessert = \u2018cake\u2019;\r\n function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\r\n export {fruit, dessert, dinner as supper};\r\n \u2014\u2014\u2014\u2014\u2014\u2013\r\n script.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u2018use strict\u2019;\r\n import {fruit, dessert, supper as dinner} from \u2018.\/modules\/chef\u2019;\r\n dinner(fruit, dessert);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u5bfc\u51fa\u4e0e\u5bfc\u5165\u9ed8\u8ba4\r\n chef.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014-\r\n \u2018use strict\u2019;\r\n let fruit = \u2018apple\u2019;\r\n let dessert = \u2018cake\u2019;\r\n \/export default function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\/\r\n function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\r\n export {dinner as default};\r\n \u2014\u2014\u2014\u2014\u2014\u2013\r\n script.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u2018use strict\u2019;\r\n import chef from \u2018.\/modules\/chef\u2019;\r\n chef(\u2018apple\u2019, \u2018cake\u2019);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u524d\u7aef \u2013 ECMAScript \u65b0\u529f\u80fd\r\n\u4f5c\u7528\u57df\r\n \u8bfe\u7a0b\u4ecb\u7ecd \u2013 ECMAScript \u65b0\u529f\u80fd\r\n \u5757\u4f5c\u7528\u57df \u2013 let\r\n \u4ee5\u524d\u7684JS\u53ea\u6709\u5168\u5c40\u4f5c\u7528\u57df\u548c\u51fd\u6570\u4f5c\u7528\u57df,\u73b0\u5728JS\u4e5f\u6709\u4e86\u5757\u7ea7\u4f5c\u7528\u57df\r\n \u2018use strict\u2019;\r\n if(true){\r\n var fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\r\n \u2018use strict\u2019;\r\n if(true){\r\n let fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\/\/\u62a5\u9519\r\n \u6052\u91cf \u2013 const\r\n const fruit = \u2018apple\u2019;\r\n console.log(fruit);\r\n const fruit = \u2018orange\u2019;\/\/\u62a5\u9519\r\n console.log(fruit);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n const fruit = [];\r\n fruit.push(\u2018apple\u2019);\r\n fruit.push(\u2018orange\u2019);\r\n fruit = [];\/\/\u62a5\u9519\r\n console.log(fruit);\r\n\u89e3\u6784\r\n \u89e3\u6784\u6570\u7ec4 \u2013 Array Destructuring\r\n \u89e3\u6784\u662fES6\u91cc\u65b0\u7684\u8bed\u6cd5,\u610f\u601d\u662f\u5206\u89e3\u4e00\u4e2a\u4e1c\u897f\u7684\u7ed3\u6784\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return [\\u2018apple\\u2019, \\u2018orange\\u2019, \\u2018banana\\u2019];\r\n }\r\n var tmp = breakfast(), a = tmp[0], b = tmp[1], c = tmp[1];\r\n let [e, f, g] = breakfast();\r\n console.log(a, b, c, e, f, g);\r\n \u89e3\u6784\u5bf9\u8c61 \u2013 Object Destructuring\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return {dessert: \u2018cake\u2019, drink: \u2018tea\u2019, fruit: \u2018apple\u2019};\r\n }\r\n let {dessert: de, drink: dr, fruit: fr} = breakfast();\r\n console.log(de, dr, fr);\r\n\u5b57\u7b26\u4e32\u6a21\u677f\r\n \u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Template Strings\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = \\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast);\r\n \u5e26\u6807\u7b7e\u7684\u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Tagged Templates\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n function kitchen(strings, \u2026values){\r\n \/\/console.log(strings);\r\n \/\/console.log(values);\r\n let result = \u201d;\r\n for(var i = 0; i < values.length; i++){\r\n result += strings[i];\r\n result += values[i];\r\n }\r\n result += strings[strings.length -1];\r\n return result;\r\n }\r\n console.log(breakfast);\r\n \u5224\u65ad\u5b57\u7b26\u4e32\u91cc\u662f\u5426\u5305\u542b\u5176\u5b83\u7684\u5b57\u7b26\u4e32\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast.startsWith(\u2018\u4eca\u5929\u2019));\r\n console.log(breakfast.endsWith(\u2018!\u2019));\r\n console.log(breakfast.includes(\u2018\u4eca\u5929\u2019));\r\n\u51fd\u6570\r\n \u9ed8\u8ba4\u53c2\u6570 \u2013 Default Parameter Values\r\n \u2018use strict\u2019;\r\n function breakfast (dessert = \u2018cake\u2019, drink = \u2018tea\u2019){\r\n return ${dessert} ${drink};\r\n }\r\n console.log(breakfast());\r\n console.log(breakfast(\u2018A\u2019, \u2018B\u2019));\r\n \u5c55\u5f00\u64cd\u4f5c\u7b26- Spread\r\n \u2018use strict\u2019;\r\n let fruits = [\\u2018apple\\u2019, \\u2018banana\\u2019],\r\n foods = [\\u2018cake\\u2019, \\u2026fruits];\r\n console.log(fruits);\r\n console.log(\u2026fruits);\r\n console.log(foods);\r\n \u5269\u4f59\u64cd\u4f5c\u7b26 \u2013 Rest\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, \u2026foods){\r\n console.log(dessert, drink, foods);\r\n console.log(dessert, drink, \u2026foods);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, \u2018apple\u2019, \u2018banana\u2019);\r\n \u89e3\u6784\u53c2\u6570 \u2013 Destructured Parameters\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, {location, restaurant} = {}){\r\n console.log(dessert, drink, location, restaurant);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, {location: \u2018china\u2019, restaurant: \u2018chinese foods\u2019});\r\n \u51fd\u6570\u7684\u540d\u5b57 \u2013 name \u5c5e\u6027\r\n \u2018use strict\u2019;\r\n let breakfast = function(argument){\r\n }\r\n console.log(breakfast.name);\r\n let breakfast = function superBreakfast(argument){\r\n }\r\n console.log(breakfast.name);\r\n \u7bad\u5934\u51fd\u6570 \u2013 Arrow Functions\r\n \u2018use strict\u2019;\r\n let breakfast = dessert => dessert;\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n babel script.js \u2013watch \u2013out-file script-compiled.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n \u2018use strict\u2019;\r\n var breakfast = function breakfast(dessert){\r\n return dessert;\r\n }\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n let breakfast = (dessert, drink) => dessert + drink;\r\n let breakfast = (dessert, drink) => {\r\n return dessert + drink;\r\n };\r\n\u5bf9\u8c61\r\n \u5bf9\u8c61\u8868\u8fbe\u5f0f\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let food = {\r\n dessert: dessert,\r\n drink: drink,\r\n };\r\n console.log(food);\r\n let food = {\r\n dessert,\r\n drink,\r\n breakfast(){\r\n }\r\n };\r\n console.log(food);\r\n \u5bf9\u8c61\u5c5e\u6027\u540d\r\n \u2018use strict\u2019;\r\n let food = {};\r\n let drink = \u2018hot drink\u2019;\r\n food.dessert = \u2018cake\u2019;\r\n food[\\u2018hot drink\\u2019] = \u2018tea\u2019;\r\n food[drink] = \u2018tea\u2019;\r\n console.log(food);\r\n \u5bf9\u6bd4\u4e24\u4e2a\u503c\u662f\u5426\u76f8\u7b49 \u2013 Object.is()\r\n \u2018use strict\u2019;\r\n > +0 == -0\r\n true\r\n > +0 === -0\r\n true\r\n > NaN == NaN\r\n false\r\n > Object.is(NaN, NaN)\r\n true\r\n Object.is(+0, -0)\r\n false\r\n \u628a\u5bf9\u8c61\u7684\u503c\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5bf9\u8c61\u91cc \u2013 Object.assign()\r\n \u2018use strict\u2019;\r\n let breakfast = {};\r\n Object.assign(\r\n breakfast,\r\n {drink: \u2018beer\u2019},\r\n {drink: \u2018tea\u2019}\r\n );\r\n console.log(breakfast);\r\n \u8bbe\u7f6e\u5bf9\u8c61\u7684 prototype \u2013 Object.setPrototypeOf()\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = Object.create(breakfast);\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === breakfast);\r\n Object.setPrototypeOf(sunday, dinner);\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === dinner);\r\n proto\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = {proto: breakfast};\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === breakfast);\r\n sunday.proto = dinner;\r\n console.log(sunday.getDrink());\r\n console.log(Object.getPrototypeOf(sunday) === dinner);\r\n super\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getDrink(){\r\n return \u2018tea\u2019;\r\n }\r\n };\r\n let dinner = {\r\n getDrink(){\r\n return \u2018beer\u2019;\r\n }\r\n };\r\n let sunday = {\r\n proto: breakfast\r\n getDrink(){\r\n return super.getDrink() + \u2018 + beer\u2019;\r\n }\r\n };\r\n console.log(sunday.getDrink());\r\n\u751f\u6210\u5668\u4e0e\u8fed\u4ee3\u5668\r\n \u8fed\u4ee3\u5668 \u2013 Iterators\r\n \u8fd4\u56de\u503c: {value: xx, done: true\/false}\r\n \u2018use strict\u2019;\r\n function chef(foods){\r\n let i = 0;\r\n return {\r\n next(){\r\n let done = (i >= foods.length);\r\n let value = !done ? foods[i++] : undefined;\r\n return {\r\n value: value,\r\n done: done\r\n }\r\n }\r\n }\r\n }\r\n let lamp9 = chef([\\u2018egg\\u2019, \\u2018potato\\u2019]);\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n \u751f\u6210\u5668 \u2013 Generators\r\n \u2018use strict\u2019;\r\n function chef(){\r\n yield \u2018egg\u2019;\r\n yield \u2018potato\u2019;\r\n }\r\n let lamp9 = chef();\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n \/function chef(foods){\r\n for(var i = 0; i < foods.length; i++){\r\n yield foods[i];\r\n }\r\n }\/\r\n let chef = function (foods){\r\n for(var i = 0; i < foods.length; i++){\r\n yield foods[i];\r\n }\r\n }\r\n let lamp9 = chef([\\u2018egg\\u2019, \\u2018potato\\u2019]);\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n console.log(lamp9.next());\r\n\u7c7b\r\n Classes \u2013 \u7c7b\r\n \u2018use strict\u2019;\r\n class Chef{\r\n constructor(food){\r\n this.food = food;\r\n }\r\n cook(){\r\n console.log(this.food);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018egg\u2019);\r\n lamp9.cook();\r\n get \u4e0e set\r\n \u2018use strict\u2019;\r\n class Chef{\r\n constructor(food){\r\n this.food = food;\r\n this.dish [];\r\n }\r\n get menu(){\r\n return this.dish;\r\n }\r\n set menu(dish){\r\n this.dish.push(dish);\r\n }\r\n cook(){\r\n console.log(this.food);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018egg\u2019);\r\n console.log(lamp9.menu = \u2018cake\u2019);\r\n console.log(lamp9.menu = \u2018tea\u2019);\r\n console.log(lamp9.menu);\r\n \u9759\u6001\u65b9\u6cd5 \u2013 static\r\n \u2018use strict\u2019;\r\n class Chef{\r\n \/\/\u2026.\r\n static cook(food){\r\n console.log(this.food);\r\n }\r\n }\r\n Chef.cook(\u2018cake\u2019);\r\n \u7ee7\u627f \u2013 extends\r\n \u2018use strict\u2019;\r\n class Person{\r\n constructor(name, brithday){\r\n this.name = name;\r\n this.birthday = birthday;\r\n }\r\n intro(){\r\n return ${this.name}, $this.birthday;\r\n }\r\n }\r\n class Chef extends Person{\r\n constructor(name, birthday){\r\n super(name, birthday);\r\n }\r\n }\r\n let lamp9 = new Chef(\u2018lamp9\u2019, \u20181999-09-09\u2019);\r\n console.log(lamp9.intro());\r\n\u96c6\u5408\r\n Set:\u4e0d\u80fd\u6709\u91cd\u590d\u7684\u5185\u5bb9\r\n \u2018use strict\u2019;\r\n let desserts = new Set(\u2018123\u2019);\r\n desserts.add(\u20184\u2019);\r\n desserts.add(\u20184\u2019);\r\n console.log(desserts);\r\n console.log(desserts.size);\r\n console.log(desserts.has(\u20181\u2019));\r\n desserts.delete(\u20181\u2019);\r\n console.log(desserts);\r\n desserts.forEach(dessert=> {\r\n console.log(dessert);\r\n });\r\n desserts.clear();\r\n console.log(desserts);\r\n Map\r\n \u2018use strict\u2019;\r\n let food = new Map();\r\n let fruit = {}, cook = function(){}, dessert = \u2018\u751c\u70b9\u2019;\r\n food.set(fruit, \u2018apple\u2019);\r\n food.set(cook, \u2018egg\u2019);\r\n food.set(dessert, \u2018cake\u2019);\r\n console.log(food);\r\n console.log(food.size);\r\n console.log(food.get(fruit));\r\n console.log(food.get(cooke));\r\n food.delete(dessert);\r\n console.log(food.has(dessert));\r\n food.forEach((value, key) => {\r\n console.log(${key} = ${value});\r\n });\r\n food.clear();\r\n console.log(food);\r\n\u6a21\u5757\r\n Modules \u2013 \u6a21\u5757\r\n as chef from \u2018.\/modules\/chef\u2019;\r\n console.log(chef.fruit, chef.dessert);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u91cd\u547d\u540d\u5bfc\u51fa\u4e0e\u5bfc\u5165\u7684\u4e1c\u897f\r\n chef.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014-\r\n \u2018use strict\u2019;\r\n let fruit = \u2018apple\u2019;\r\n let dessert = \u2018cake\u2019;\r\n function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\r\n export {fruit, dessert, dinner as supper};\r\n \u2014\u2014\u2014\u2014\u2014\u2013\r\n script.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u2018use strict\u2019;\r\n import {fruit, dessert, supper as dinner} from \u2018.\/modules\/chef\u2019;\r\n dinner(fruit, dessert);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u5bfc\u51fa\u4e0e\u5bfc\u5165\u9ed8\u8ba4\r\n chef.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014-\r\n \u2018use strict\u2019;\r\n let fruit = \u2018apple\u2019;\r\n let dessert = \u2018cake\u2019;\r\n \/export default function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\/\r\n function dinner(fruit, dessert){\r\n console.log(\\u4eca\\u5929\\u7684\\u665a\\u9910\\u662f: ${fruit} \\u548c ${dessert});\r\n }\r\n export {dinner as default};\r\n \u2014\u2014\u2014\u2014\u2014\u2013\r\n script.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n \u2018use strict\u2019;\r\n import chef from \u2018.\/modules\/chef\u2019;\r\n chef(\u2018apple\u2019, \u2018cake\u2019);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u524d\u7aef \u2013 ECMAScript \u65b0\u529f\u80fd\r\n\u4f5c\u7528\u57df\r\n \u8bfe\u7a0b\u4ecb\u7ecd \u2013 ECMAScript \u65b0\u529f\u80fd\r\n \u5757\u4f5c\u7528\u57df \u2013 let\r\n \u4ee5\u524d\u7684JS\u53ea\u6709\u5168\u5c40\u4f5c\u7528\u57df\u548c\u51fd\u6570\u4f5c\u7528\u57df,\u73b0\u5728JS\u4e5f\u6709\u4e86\u5757\u7ea7\u4f5c\u7528\u57df\r\n \u2018use strict\u2019;\r\n if(true){\r\n var fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\r\n \u2018use strict\u2019;\r\n if(true){\r\n let fruit = \u2018apple\u2019;\r\n }\r\n console.log(fruit);\/\/\u62a5\u9519\r\n \u6052\u91cf \u2013 const\r\n const fruit = \u2018apple\u2019;\r\n console.log(fruit);\r\n const fruit = \u2018orange\u2019;\/\/\u62a5\u9519\r\n console.log(fruit);\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n const fruit = [];\r\n fruit.push(\u2018apple\u2019);\r\n fruit.push(\u2018orange\u2019);\r\n fruit = [];\/\/\u62a5\u9519\r\n console.log(fruit);\r\n\u89e3\u6784\r\n \u89e3\u6784\u6570\u7ec4 \u2013 Array Destructuring\r\n \u89e3\u6784\u662fES6\u91cc\u65b0\u7684\u8bed\u6cd5,\u610f\u601d\u662f\u5206\u89e3\u4e00\u4e2a\u4e1c\u897f\u7684\u7ed3\u6784\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return [\\u2018apple\\u2019, \\u2018orange\\u2019, \\u2018banana\\u2019];\r\n }\r\n var tmp = breakfast(), a = tmp[0], b = tmp[1], c = tmp[1];\r\n let [e, f, g] = breakfast();\r\n console.log(a, b, c, e, f, g);\r\n \u89e3\u6784\u5bf9\u8c61 \u2013 Object Destructuring\r\n \u2018use strict\u2019;\r\n function breakfast(){\r\n return {dessert: \u2018cake\u2019, drink: \u2018tea\u2019, fruit: \u2018apple\u2019};\r\n }\r\n let {dessert: de, drink: dr, fruit: fr} = breakfast();\r\n console.log(de, dr, fr);\r\n\u5b57\u7b26\u4e32\u6a21\u677f\r\n \u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Template Strings\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = \\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast);\r\n \u5e26\u6807\u7b7e\u7684\u6a21\u677f\u5b57\u7b26\u4e32 \u2013 Tagged Templates\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n function kitchen(strings, \u2026values){\r\n \/\/console.log(strings);\r\n \/\/console.log(values);\r\n let result = \u201d;\r\n for(var i = 0; i < values.length; i++){\r\n result += strings[i];\r\n result += values[i];\r\n }\r\n result += strings[strings.length -1];\r\n return result;\r\n }\r\n console.log(breakfast);\r\n \u5224\u65ad\u5b57\u7b26\u4e32\u91cc\u662f\u5426\u5305\u542b\u5176\u5b83\u7684\u5b57\u7b26\u4e32\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let breakfast = kitchen\\u4eca\\u5929\\u7684\\u65e9\\u9910\\u662f \\\\n\\r\\n ${dessert} \\u548c ${drink};\r\n console.log(breakfast.startsWith(\u2018\u4eca\u5929\u2019));\r\n console.log(breakfast.endsWith(\u2018!\u2019));\r\n console.log(breakfast.includes(\u2018\u4eca\u5929\u2019));\r\n\u51fd\u6570\r\n \u9ed8\u8ba4\u53c2\u6570 \u2013 Default Parameter Values\r\n \u2018use strict\u2019;\r\n function breakfast (dessert = \u2018cake\u2019, drink = \u2018tea\u2019){\r\n return ${dessert} ${drink};\r\n }\r\n console.log(breakfast());\r\n console.log(breakfast(\u2018A\u2019, \u2018B\u2019));\r\n \u5c55\u5f00\u64cd\u4f5c\u7b26- Spread\r\n \u2018use strict\u2019;\r\n let fruits = [\\u2018apple\\u2019, \\u2018banana\\u2019],\r\n foods = [\\u2018cake\\u2019, \\u2026fruits];\r\n console.log(fruits);\r\n console.log(\u2026fruits);\r\n console.log(foods);\r\n \u5269\u4f59\u64cd\u4f5c\u7b26 \u2013 Rest\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, \u2026foods){\r\n console.log(dessert, drink, foods);\r\n console.log(dessert, drink, \u2026foods);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, \u2018apple\u2019, \u2018banana\u2019);\r\n \u89e3\u6784\u53c2\u6570 \u2013 Destructured Parameters\r\n \u2018use strict\u2019;\r\n function breakfast(dessert, drink, {location, restaurant} = {}){\r\n console.log(dessert, drink, location, restaurant);\r\n }\r\n breakfast(\u2018cake\u2019, \u2018tea\u2019, {location: \u2018china\u2019, restaurant: \u2018chinese foods\u2019});\r\n \u51fd\u6570\u7684\u540d\u5b57 \u2013 name \u5c5e\u6027\r\n \u2018use strict\u2019;\r\n let breakfast = function(argument){\r\n }\r\n console.log(breakfast.name);\r\n let breakfast = function superBreakfast(argument){\r\n }\r\n console.log(breakfast.name);\r\n \u7bad\u5934\u51fd\u6570 \u2013 Arrow Functions\r\n \u2018use strict\u2019;\r\n let breakfast = dessert => dessert;\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\r\n babel script.js \u2013watch \u2013out-file script-compiled.js\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n \u2018use strict\u2019;\r\n var breakfast = function breakfast(dessert){\r\n return dessert;\r\n }\r\n \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013\r\n let breakfast = (dessert, drink) => dessert + drink;\r\n let breakfast = (dessert, drink) => {\r\n return dessert + drink;\r\n };\r\n\u5bf9\u8c61\r\n \u5bf9\u8c61\u8868\u8fbe\u5f0f\r\n \u2018use strict\u2019;\r\n let dessert = \u2018cake\u2019, drink = \u2018tea\u2019;\r\n let food = {\r\n dessert: dessert,\r\n drink: drink,\r\n };\r\n console.log(food);\r\n let food = {\r\n dessert,\r\n drink,\r\n breakfast(){\r\n }\r\n };\r\n console.log(food);\r\n \u5bf9\u8c61\u5c5e\u6027\u540d\r\n \u2018use strict\u2019;\r\n let food = {};\r\n let drink = \u2018hot drink\u2019;\r\n food.dessert = \u2018cake\u2019;\r\n food[\\u2018hot drink\\u2019] = \u2018tea\u2019;\r\n food[drink] = \u2018tea\u2019;\r\n console.log(food);\r\n \u5bf9\u6bd4\u4e24\u4e2a\u503c\u662f\u5426\u76f8\u7b49 \u2013 Object.is()\r\n \u2018use strict\u2019;\r\n > +0 == -0\r\n true\r\n > +0 === -0\r\n true\r\n > NaN == NaN\r\n false\r\n > Object.is(NaN, NaN)\r\n true\r\n Object.is(+0, -0)\r\n false\r\n \u628a\u5bf9\u8c61\u7684\u503c\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5bf9\u8c61\u91cc \u2013 Object.assign()\r\n \u2018use strict\u2019;\r\n let breakfast = {};\r\n Object.assign(\r\n breakfast,\r\n {drink: \u2018beer\u2019},\r\n {drink: \u2018tea\u2019}\r\n );\r\n console.log(breakfast);\r\n \u8bbe\u7f6e\u5bf9\u8c61\u7684 prototype \u2013 Object.setPrototypeOf()\r\n \u2018use strict\u2019;\r\n let breakfast = {\r\n getD

ar Data too long yii\db\Exception
    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册
在线
229