1: Introducing ECMAScript 6
2. Utilizing Variables
3: Converting Arrow Functions
4: Upgrading Arrow Functions
5: Converting to Template Literals


1: Introducing ECMAScript 6

js เป็น asynchronous by nature

Beginning with ECMAScript
ES 6 – 2015
Understanding Scope
scope คือ region ที่ program binding, association name เพื่อ entity , eg variable , function , JS มี 2 type of scope
– Function scope
– Block scope
มาจนถึง ES6 , js มีเพียง function scope , รวมถึง variable and function declaration จะอยู่ใน function scope sules
– ส่วน block scope เริ่มเข้ามา ES6 , ใช้เมื่อมี variable declared และมีตัวใหม่มาคือ let , const <- 2 อันนี้ อยู่ใน Declaraing variables sections

Function Scope
เมื่อมี function declare , new scope block จะถูกสร้างภายใน body function
– variables ที่ declare ภายใน new function scope นี้ , จะไม่สามารถ access from parent scope
– แต่ function scope สามารถ access variable ใน parent scope
– ถ้าจะสร้าง variable with function scope , เราต้อง declare variable with var keyword
var example = 5 ;

p 37


2. Utilizing Variables

3: Converting Arrow Functions

4: Upgrading Arrow Functions

5: Converting to Template Literals