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

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
 

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)

PPTX
Airbnb Java Script style guide
Ahmed Elbassel
 
PPTX
Airbnb Javascript Style Guide
Creative Partners
 
PDF
l2-es6-160830040119.pdf
Hương Trà Pé Xjnk
 
PPTX
Getting started with ES6 : Future of javascript
Mohd Saeed
 
PDF
You Don t Know JS ES6 Beyond Kyle Simpson
gedayelife
 
PDF
Impress Your Friends with EcmaScript 2015
Lukas Ruebbelke
 
PPTX
The ES Library for JavaScript Developers
Ganesh Bhosale
 
PDF
ES6 General Introduction
Thomas Johnston
 
PDF
Es.next
Ignacio Gil
 
PPTX
ECMAScript 2015
Sebastian Pederiva
 
PDF
Effective ES6
Teppei Sato
 
PDF
Intro to React
Troy Miles
 
PDF
What's New in ES6 for Web Devs
Rami Sayar
 
PPTX
Introduction to es6
NexThoughts Technologies
 
PDF
Fitc whats new in es6 for web devs
FITC
 
PDF
Whats new in ES2019
chayanikaa
 
PPTX
ES6 - JavaCro 2016
Nenad Pecanac
 
PDF
Introduction to web programming for java and c# programmers by @drpicox
David Rodenas
 
PDF
MCS First Year JavaScript ES6 Features.pdf
KavitaSawant18
 
PPTX
ES6: Features + Rails
Santosh Wadghule
 
Airbnb Java Script style guide
Ahmed Elbassel
 
Airbnb Javascript Style Guide
Creative Partners
 
l2-es6-160830040119.pdf
Hương Trà Pé Xjnk
 
Getting started with ES6 : Future of javascript
Mohd Saeed
 
You Don t Know JS ES6 Beyond Kyle Simpson
gedayelife
 
Impress Your Friends with EcmaScript 2015
Lukas Ruebbelke
 
The ES Library for JavaScript Developers
Ganesh Bhosale
 
ES6 General Introduction
Thomas Johnston
 
Es.next
Ignacio Gil
 
ECMAScript 2015
Sebastian Pederiva
 
Effective ES6
Teppei Sato
 
Intro to React
Troy Miles
 
What's New in ES6 for Web Devs
Rami Sayar
 
Introduction to es6
NexThoughts Technologies
 
Fitc whats new in es6 for web devs
FITC
 
Whats new in ES2019
chayanikaa
 
ES6 - JavaCro 2016
Nenad Pecanac
 
Introduction to web programming for java and c# programmers by @drpicox
David Rodenas
 
MCS First Year JavaScript ES6 Features.pdf
KavitaSawant18
 
ES6: Features + Rails
Santosh Wadghule
 
Ad

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)

PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PPTX
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Executive Business Intelligence Dashboards
vandeslie24
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Import Data Form Excel to Tally Services
Tally xperts
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Tally software_Introduction_Presentation
AditiBansal54083
 

Lecture 3 - ES6 Script Advanced for React-Native