Lecture 2: ES6/ES2015 and Beyonds With The Best Practices
Lecture 2: ES6/ES2015 and Beyonds With The Best Practices
• Standardized by Ecma
International in
ECMA-262 and
ISO/IEC
16262, based on
JavaScript
• First Appeared June
1997, 19 year ago.
Significant Development
• V8 JavaScript engine (2008). To compete with Internet
Explorer on JavaScript benchmark, Google developed v8 that
can compile JavaScript to Native Machine code. It is very
fast.
• NodeJS + NPM (2009): Using V8 to make server-
side JavaScript Web Application.
• Type “Terminal”
https://atom.io/
Setup the Project
• Download atom IDE and install
• $ cd workingFolder
• $ cd l2es6
• $ react-native run-ios
• $ atom .
Making a new JS file
Right click on l2es6, Select New File, Type down a new file
with JS extension
IntelliJ IDEA
https://www.jetbrains.com/idea/
NativeBase
https://nativebase.io/
Let’s Start with ES6
ES6 Basic
• /* Comment */
• // Comment
• console.log(‘print out’);
• string
• number
• boolean
• null
• undefined
Primitive Type #1: String, Number, and Boolean
Primitive Type #2: Null, Undefined, and Reference by Value
Exercise 1
Complex Types
• Reference of its value
• object
• array
• function
Complex Type #1: Object & Array
Complex Type #2: Function and Pass by Reference
Exercise 2
Declaration
(Var, Let and Const)
• Var, Let, Const = Making Variable Declaration
• Block-Level Scope
• Block-Level Scope
• Global-Level Scope
• Old JavaScript
Starting code
HomeWork 1
(1) Write down a function that sum every element in
array. E.g. sumArray([12,3,4,1,2,3]) = 25
HomeWork 2
(2) Write function that count word size case-insensitively.