SlideShare a Scribd company logo
Lecture 3: ES6/ES2015 and
Beyonds with the Best Practices

Kobkrit Viriyayudhakorn, Ph.D.
CEO of iApp Technology Limited.
kobkrit@gmail.com
http://www.kobkrit.com
Object #4: Pass by Reference
Object #5: Clone a Object
Object #6: Functions in Objects
Object #7: ES6 Features - Dynamic Keys & Function
Shorthand
Object #8: ES6 Features - Property Value Shorthand &
Destructuring
Object #9: ES6 Features - Sprades Operators
Exercise #1
Object’s Airbnb Style Guides
Style Guide #1. Use literal syntax for object creation.
Style Guide #2: Define All Property in One Place
Style Guide #3: Use Object Method Shorthand
Style Guide #4: Use Property Value Shorthand

Why? It is shorter to write and descriptive.
Style Guide #5: Group your shorthand properties

at the beginning of your object declaration.

Why? It’s easier to tell which one are using shorthand.

Style Guide #6: Only quote properties that are invalid
identifiers

Why? Easier to Read. Easily Optimized by many JS Engines.
Style Guide #7: Use dot notation when accessing properties.

Use bracket when accessing properties with a variable.
Array
• Array is a list data structure.
• Sequence of objects
Array #1: Declaration, Update, Length
Array #2: Delete, Sub-Array
Array #3: Push, Pop, Unshift, Shift
Array #4: Array.isArray, [].indexOf
Array #5: Loop
Exercise #2
• Write down a function to be able to add a number
to all numbers in an array.
Array #6: Sort, Reverse
Array #7: Array <-> String, 2D and 3D Array
Array #8: [].forEach
Array #9: ES6 Features: Array Spreads …, Array.from, Array.of
Array #10: ES6 Features: [].fill, [].find, [].findIndex, [].map
Array #11: ES6 Features: [].reduce, [].filter
Array #12: ES6 Features: Destructuring
Exercise #3
• Do the same with Exercise #2, but using array.map
only!
Array’s Airbnb Style Guides
Style Guide #1. Use literal syntax for array creation.
Style Guide #2. Use Array.push() instead of direct assignment
to add items to an array.
Style Guide #3. Use array spreads ... to copy arrays.
Style Guide #4-1 Use return statements in array method
callbacks. It's ok to omit the return if the function body consists
of a single statement
Style Guide #4-2 Use return statements in array method
callbacks. It's ok to omit the return if the function body consists
of a single statement
String
String #1: Declaration, Concatenation, NewLine
String #2: ES6 Feature - Template Strings
String #3: Number <-> Strings
String #4: IndexOf, Search, Replace
String #5: IndexOf, Search, Replace, Compare
String #6: charAt, slice, toLowerCase, toUpperCase, trim,
includes
String #7: startsWith, endsWith, Repeats
Exercise #4
Write function that count word size case-insensitively.
Input: "Hello world hello hello earth earth" (Not limited to
these word, it can be any words)
Output: Object{hello : 3, world : 1, earth : 2 }
String’s Airbnb Style Guides
Style Guide #1. Use single quote ‘ ‘ for Strings
Style Guide #2. Strings that cause the line to go over 100
characters should not be written across multiple lines using
string concatenation.
…
Style Guide #3 When programmatically building up strings,
use template strings instead of concatenation
…
Style Guide #4 - Do not unnecessarily escape characters in
strings.
…
Class
• Programming Paradigm that Encapsulate data and methods based
on the concept of real world objects.
• JavaScript never have Class concept before. They just added in ES6.
• I personally like the function-oriented nature of JavaScript more. But
by adding the Class, it make the object-oriented programming in
JavaScript a lot easier and nicer.
Class #1: ES6 Feature - Declaration, Instantiate
Class #2: ES6 Feature - Extend
Class #3: ES6 Feature - Getter/Setter
Class’s Airbnb Style Guides
Style Guide #1. Methods can return this, to enable method
chaining.
Style Guide #2 Classes have a default constructor if one is not
specified. An empty constructor function or one that just
delegates to a parent class is unnecessary.
Modules
• ES6 gave us a native way to organize our code into
modules.
Module #1: ES6 Feature - Import, Export
Module’s Airbnb Style Guides
Style Guide #1 Do not use wildcard imports.
Style Guide #2 Only import from a path in one place
Style Guide #3: Put all imports above non-import statements.
Style Guide #4: Do not export directly from an import
Style Guide #5: Do not export mutable bindings.
Style Guide #6: In modules with a single export, prefer default
export over named export.
HomeWork
Let’s say: '(', '{', '[' are called “openers." 

')', '}', ']' are called "closers."
Write an efficient function that tells us whether or not an input
string's openers and closers are properly nested.
Examples:
"{ [ ] ( ) }" should return true
"{ [ ( ] ) }" should return false
"{ [ }" should return false

More Related Content

PDF
Lecture 2: ES6 / ES2015 Slide
Kobkrit Viriyayudhakorn
 
PDF
Ryan Christiani I Heard React Was Good
FITC
 
PDF
Angular Application Testing
Troy Miles
 
PDF
Intro To React Native
FITC
 
PDF
Introduction to React Native
Polidea
 
PDF
Dynamically Composing Collection Operations through Collection Promises
Marcus Denker
 
PDF
Ng talk
Aymene Bennour
 
PDF
React Native - Getting Started
Tracy Lee
 
Lecture 2: ES6 / ES2015 Slide
Kobkrit Viriyayudhakorn
 
Ryan Christiani I Heard React Was Good
FITC
 
Angular Application Testing
Troy Miles
 
Intro To React Native
FITC
 
Introduction to React Native
Polidea
 
Dynamically Composing Collection Operations through Collection Promises
Marcus Denker
 
React Native - Getting Started
Tracy Lee
 

What's hot (20)

PDF
Some experiences building an Android app with React Native & Redux
Alex Bepple
 
PDF
Variables in Pharo5
Marcus Denker
 
PDF
Reflection in Pharo: Beyond Smalltak
Marcus Denker
 
PPTX
Angular 2
Nigam Goyal
 
PPTX
Introduction to Core Java Programming
Raveendra R
 
PDF
Intro to javascript (4 week)
Jamal Sinclair O'Garro
 
PPTX
JavaScript operators
Vivek Kumar
 
PDF
Reflection in Pharo: Beyond Smalltak
Marcus Denker
 
PPTX
Iterable, iterator, generator by gaurav khurana
Gaurav Khurana
 
PPTX
LINQ in C#
Basant Medhat
 
PDF
RBC Mod 1: Making a New Rails App
ameedahc
 
PDF
Reflection in Pharo5
Marcus Denker
 
PDF
Advanced Reflection in Pharo
Marcus Denker
 
PDF
Striking a Balance With UI Tests - ConnectTech
stable|kernel
 
PDF
Xtend - better java with -less- noise
Neeraj Bhusare
 
PPTX
Creating custom Validators on Reactive Forms using Angular 6
AIMDek Technologies
 
PPTX
C# advanced topics and future - C#5
Peter Gfader
 
PPT
C#/.NET Little Pitfalls
BlackRabbitCoder
 
DOCX
Ruby Interview Questions
Sumanth krishna
 
PDF
Serialization
Salman Mushtaq
 
Some experiences building an Android app with React Native & Redux
Alex Bepple
 
Variables in Pharo5
Marcus Denker
 
Reflection in Pharo: Beyond Smalltak
Marcus Denker
 
Angular 2
Nigam Goyal
 
Introduction to Core Java Programming
Raveendra R
 
Intro to javascript (4 week)
Jamal Sinclair O'Garro
 
JavaScript operators
Vivek Kumar
 
Reflection in Pharo: Beyond Smalltak
Marcus Denker
 
Iterable, iterator, generator by gaurav khurana
Gaurav Khurana
 
LINQ in C#
Basant Medhat
 
RBC Mod 1: Making a New Rails App
ameedahc
 
Reflection in Pharo5
Marcus Denker
 
Advanced Reflection in Pharo
Marcus Denker
 
Striking a Balance With UI Tests - ConnectTech
stable|kernel
 
Xtend - better java with -less- noise
Neeraj Bhusare
 
Creating custom Validators on Reactive Forms using Angular 6
AIMDek Technologies
 
C# advanced topics and future - C#5
Peter Gfader
 
C#/.NET Little Pitfalls
BlackRabbitCoder
 
Ruby Interview Questions
Sumanth krishna
 
Serialization
Salman Mushtaq
 
Ad

Viewers also liked (6)

PDF
ES2015 / ES6: Basics of modern Javascript
Wojciech Dzikowski
 
PDF
ES2015 (ES6) Overview
hesher
 
PDF
ES6: The Awesome Parts
Domenic Denicola
 
PDF
ES6 in Production [JSConfUY2015]
Guillermo Paz
 
PDF
객체지향 철학 그리고 5대 개념
중선 곽
 
PDF
객체지향 개념 (쫌 아는체 하기)
Seung-June Lee
 
ES2015 / ES6: Basics of modern Javascript
Wojciech Dzikowski
 
ES2015 (ES6) Overview
hesher
 
ES6: The Awesome Parts
Domenic Denicola
 
ES6 in Production [JSConfUY2015]
Guillermo Paz
 
객체지향 철학 그리고 5대 개념
중선 곽
 
객체지향 개념 (쫌 아는체 하기)
Seung-June Lee
 
Ad

Similar to Lecture 3 - ES6 Script Advanced for React-Native (20)

PDF
l2-es6-160830040119.pdf
Hương Trà Pé Xjnk
 
PDF
Practical Rust 1x Cookbook Rustacean Team
mavukahimota22
 
PDF
Perfomatix - iOS swift coding standards
Perfomatix Solutions
 
PDF
Week 2
EasyStudy3
 
PDF
2.Getting Started with C#.Net-(C#)
Shoaib Ghachi
 
PPT
C# features
sagaroceanic11
 
PPTX
Switch statement
Patrick John McGee
 
PPTX
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - Lecture
Rainer Winkler
 
PDF
Design Patterns in iOS
Yi-Shou Chen
 
PDF
Complete JavaScript Guide Notes Examples
Javier Crisostomo
 
PDF
Effective Python 90 specific ways to write better Python Second Edition Brett...
koldakeittlj
 
PDF
Effective Python 90 specific ways to write better Python Second Edition Brett...
hcuscmriqq641
 
PPTX
The advantage of developing with TypeScript
Corley S.r.l.
 
PPTX
AngularConf2015
Alessandro Giorgetti
 
PDF
Core java-training-course-content
venkateshcs6
 
PDF
Core java-course-content
AmanCSE1
 
PDF
Core java-course-content
AmanCSE1
 
PDF
Angular2 with TypeScript
Rohit Bishnoi
 
PPSX
Java annotations
FAROOK Samath
 
PDF
Before you jump into Angular
M A Hossain Tonu
 
l2-es6-160830040119.pdf
Hương Trà Pé Xjnk
 
Practical Rust 1x Cookbook Rustacean Team
mavukahimota22
 
Perfomatix - iOS swift coding standards
Perfomatix Solutions
 
Week 2
EasyStudy3
 
2.Getting Started with C#.Net-(C#)
Shoaib Ghachi
 
C# features
sagaroceanic11
 
Switch statement
Patrick John McGee
 
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - Lecture
Rainer Winkler
 
Design Patterns in iOS
Yi-Shou Chen
 
Complete JavaScript Guide Notes Examples
Javier Crisostomo
 
Effective Python 90 specific ways to write better Python Second Edition Brett...
koldakeittlj
 
Effective Python 90 specific ways to write better Python Second Edition Brett...
hcuscmriqq641
 
The advantage of developing with TypeScript
Corley S.r.l.
 
AngularConf2015
Alessandro Giorgetti
 
Core java-training-course-content
venkateshcs6
 
Core java-course-content
AmanCSE1
 
Core java-course-content
AmanCSE1
 
Angular2 with TypeScript
Rohit Bishnoi
 
Java annotations
FAROOK Samath
 
Before you jump into Angular
M A Hossain Tonu
 

More from Kobkrit Viriyayudhakorn (20)

PDF
Thai E-Voting System
Kobkrit Viriyayudhakorn
 
PPTX
Thai National ID Card OCR
Kobkrit Viriyayudhakorn
 
PPTX
Chochae Robot - Thai voice communication extension pack for Service Robot
Kobkrit Viriyayudhakorn
 
PDF
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
Kobkrit Viriyayudhakorn
 
PDF
Thai Text processing by Transfer Learning using Transformer (Bert)
Kobkrit Viriyayudhakorn
 
PDF
How Emoticon Affects Chatbot Users
Kobkrit Viriyayudhakorn
 
PPTX
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
Kobkrit Viriyayudhakorn
 
PDF
Check Raka Chatbot Pitching Presentation
Kobkrit Viriyayudhakorn
 
PPTX
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
Kobkrit Viriyayudhakorn
 
PPTX
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
Kobkrit Viriyayudhakorn
 
PPTX
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
Kobkrit Viriyayudhakorn
 
PDF
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
Kobkrit Viriyayudhakorn
 
PDF
Lecture 12: React-Native Firebase Authentication
Kobkrit Viriyayudhakorn
 
PDF
Unity Google VR Cardboard Deployment on iOS and Android
Kobkrit Viriyayudhakorn
 
PDF
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
Kobkrit Viriyayudhakorn
 
PDF
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Kobkrit Viriyayudhakorn
 
PDF
Lecture 2: C# Programming for VR application in Unity
Kobkrit Viriyayudhakorn
 
PDF
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
 
PDF
Thai Word Embedding with Tensorflow
Kobkrit Viriyayudhakorn
 
PDF
สร้างซอฟต์แวร์อย่างไรให้โดนใจผู้คน (How to make software that people love)
Kobkrit Viriyayudhakorn
 
Thai E-Voting System
Kobkrit Viriyayudhakorn
 
Thai National ID Card OCR
Kobkrit Viriyayudhakorn
 
Chochae Robot - Thai voice communication extension pack for Service Robot
Kobkrit Viriyayudhakorn
 
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
Kobkrit Viriyayudhakorn
 
Thai Text processing by Transfer Learning using Transformer (Bert)
Kobkrit Viriyayudhakorn
 
How Emoticon Affects Chatbot Users
Kobkrit Viriyayudhakorn
 
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
Kobkrit Viriyayudhakorn
 
Check Raka Chatbot Pitching Presentation
Kobkrit Viriyayudhakorn
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
Kobkrit Viriyayudhakorn
 
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
Kobkrit Viriyayudhakorn
 
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
Kobkrit Viriyayudhakorn
 
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
Kobkrit Viriyayudhakorn
 
Lecture 12: React-Native Firebase Authentication
Kobkrit Viriyayudhakorn
 
Unity Google VR Cardboard Deployment on iOS and Android
Kobkrit Viriyayudhakorn
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
Kobkrit Viriyayudhakorn
 
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Kobkrit Viriyayudhakorn
 
Lecture 2: C# Programming for VR application in Unity
Kobkrit Viriyayudhakorn
 
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
 
Thai Word Embedding with Tensorflow
Kobkrit Viriyayudhakorn
 
สร้างซอฟต์แวร์อย่างไรให้โดนใจผู้คน (How to make software that people love)
Kobkrit Viriyayudhakorn
 

Recently uploaded (20)

PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PDF
Wondershare Filmora 14.5.20.12999 Crack Full New Version 2025
gsgssg2211
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PPTX
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PDF
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
Wondershare Filmora 14.5.20.12999 Crack Full New Version 2025
gsgssg2211
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
Activate_Methodology_Summary presentatio
annapureddyn
 
oapresentation.pptx
mehatdhavalrajubhai
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Jenkins: An open-source automation server powering CI/CD Automation
SaikatBasu37
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 

Lecture 3 - ES6 Script Advanced for React-Native