File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Essential ES6 / ES2015 JavaScript
2+
3+ > [ http://youtu.be/CozSF5abcTA ] ( http://youtu.be/CozSF5abcTA )
4+
5+ Install [ io.js] ( https://iojs.org/en/index.html ) .
6+
7+ Within this folder run the terminal command ` npm install ` to install the
8+ ` devDependencies ` .
9+
10+ Then run ` npm start ` to start up a development server on ` http://localhost:9966 `
Original file line number Diff line number Diff line change 1+ /*
2+ * let
3+ */
4+ // let type = 'grizzly'
5+ //
6+ // while (true) {
7+ // let type = 'polar'
8+ // console.log(type)
9+ // break
10+ // }
11+ //
12+ // console.log(type)
13+
14+
15+ /*
16+ * const
17+ */
18+ // const PI = Math.PI
19+ // PI = 123
20+
21+ // const moment = require('moment')
22+
23+
24+ /*
25+ * class, extends, super
26+ */
27+ // class Bear {
28+ // constructor () {
29+ // this.type = 'bear'
30+ // }
31+ // says (say) {
32+ // console.log(this.type + ' says ' + say)
33+ // }
34+ // }
35+ //
36+ // class Grizzly extends Bear {
37+ // constructor () {
38+ // super()
39+ // this.type = 'grizzly'
40+ // }
41+ // }
42+ //
43+ // let bear = new Grizzly()
44+ // bear.says('growl')
45+
46+
47+ /*
48+ * arrow functions
49+ */
50+ // let bears = ['polar', 'koala'].filter((bear) => {
51+ // return bear !== 'koala'
52+ // })
53+ // console.log(bears)
54+
55+ // class Bear {
56+ // constructor () {
57+ // this.type = 'bear'
58+ // }
59+ // says (say) {
60+ // setTimeout(() => {
61+ // console.log(this.type + ' says ' + say)
62+ // }, 1000)
63+ // }
64+ // }
65+ // var bear = new Bear()
66+ // bear.says()
67+
68+
69+ /*
70+ * multiline strings
71+ */
72+ // let bears = `
73+ // grizzly
74+ // polar
75+ // `
76+
77+
78+ /*
79+ * template strings
80+ */
81+ // let bear = 'grizzly'
82+ // let says = 'growl'
83+ // console.log(`The ${bear} says ${says}`)
84+
85+
86+ /*
87+ * destructuring
88+ */
89+ // let bear = 'grizzly'
90+ // let says = 'growl'
91+ // let zoo = { bear, says }
92+ // //console.log(zoo)
93+ //
94+ // let grizzly = { type: 'grizzly', many: 2 }
95+ // let { type, many } = grizzly
96+ // console.log(many, type)
97+
98+
99+ /*
100+ * default arguments
101+ */
102+ function bear ( type = 'grizzly' ) {
103+ console . log ( type )
104+ }
105+ //bear()
106+
107+
108+ /*
109+ * rest arguments
110+ */
111+ function bears ( ...types ) {
112+ console . log ( types )
113+ }
114+ bears ( 'polar' , 'grizzly' , 'brown' )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " essential-es6-es2015" ,
3+ "version" : " 0.1.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "start" : " budo index.js --live"
8+ },
9+ "author" : " Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)" ,
10+ "license" : " MIT" ,
11+ "devDependencies" : {
12+ "babel" : " ^5.4.7" ,
13+ "babelify" : " ^6.1.2"
14+ },
15+ "browserify" : {
16+ "transform" : [
17+ " babelify"
18+ ]
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments