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
PDF
Ryan Christiani I Heard React Was Good
PDF
Angular Application Testing
PDF
Intro To React Native
PDF
Introduction to React Native
PDF
Dynamically Composing Collection Operations through Collection Promises
PDF
PDF
React Native - Getting Started
Lecture 2: ES6 / ES2015 Slide
Ryan Christiani I Heard React Was Good
Angular Application Testing
Intro To React Native
Introduction to React Native
Dynamically Composing Collection Operations through Collection Promises
React Native - Getting Started

What's hot (20)

PDF
Some experiences building an Android app with React Native & Redux
PDF
Variables in Pharo5
PDF
Reflection in Pharo: Beyond Smalltak
PPTX
Angular 2
PPTX
Introduction to Core Java Programming
PDF
Intro to javascript (4 week)
PPTX
JavaScript operators
PDF
Reflection in Pharo: Beyond Smalltak
PPTX
Iterable, iterator, generator by gaurav khurana
PPTX
LINQ in C#
PDF
RBC Mod 1: Making a New Rails App
PDF
Reflection in Pharo5
PDF
Advanced Reflection in Pharo
PDF
Striking a Balance With UI Tests - ConnectTech
PDF
Xtend - better java with -less- noise
PPTX
Creating custom Validators on Reactive Forms using Angular 6
PPTX
C# advanced topics and future - C#5
PPT
C#/.NET Little Pitfalls
DOCX
Ruby Interview Questions
PDF
Serialization
Some experiences building an Android app with React Native & Redux
Variables in Pharo5
Reflection in Pharo: Beyond Smalltak
Angular 2
Introduction to Core Java Programming
Intro to javascript (4 week)
JavaScript operators
Reflection in Pharo: Beyond Smalltak
Iterable, iterator, generator by gaurav khurana
LINQ in C#
RBC Mod 1: Making a New Rails App
Reflection in Pharo5
Advanced Reflection in Pharo
Striking a Balance With UI Tests - ConnectTech
Xtend - better java with -less- noise
Creating custom Validators on Reactive Forms using Angular 6
C# advanced topics and future - C#5
C#/.NET Little Pitfalls
Ruby Interview Questions
Serialization
Ad

Viewers also liked (6)

PDF
ES2015 / ES6: Basics of modern Javascript
PDF
ES2015 (ES6) Overview
PDF
ES6: The Awesome Parts
PDF
ES6 in Production [JSConfUY2015]
PDF
객체지향 철학 그리고 5대 개념
PDF
객체지향 개념 (쫌 아는체 하기)
ES2015 / ES6: Basics of modern Javascript
ES2015 (ES6) Overview
ES6: The Awesome Parts
ES6 in Production [JSConfUY2015]
객체지향 철학 그리고 5대 개념
객체지향 개념 (쫌 아는체 하기)
Ad

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

PPTX
Airbnb Java Script style guide
PPTX
Airbnb Javascript Style Guide
PDF
l2-es6-160830040119.pdf
PPTX
Getting started with ES6 : Future of javascript
PDF
You Don t Know JS ES6 Beyond Kyle Simpson
PDF
Impress Your Friends with EcmaScript 2015
PPTX
The ES Library for JavaScript Developers
PDF
ES6 General Introduction
PDF
Es.next
PPTX
ECMAScript 2015
PDF
Effective ES6
PDF
Intro to React
PDF
What's New in ES6 for Web Devs
PPTX
Introduction to es6
PDF
Fitc whats new in es6 for web devs
PDF
Whats new in ES2019
PPTX
ES6 - JavaCro 2016
PDF
Introduction to web programming for java and c# programmers by @drpicox
PDF
MCS First Year JavaScript ES6 Features.pdf
PPTX
ES6: Features + Rails
Airbnb Java Script style guide
Airbnb Javascript Style Guide
l2-es6-160830040119.pdf
Getting started with ES6 : Future of javascript
You Don t Know JS ES6 Beyond Kyle Simpson
Impress Your Friends with EcmaScript 2015
The ES Library for JavaScript Developers
ES6 General Introduction
Es.next
ECMAScript 2015
Effective ES6
Intro to React
What's New in ES6 for Web Devs
Introduction to es6
Fitc whats new in es6 for web devs
Whats new in ES2019
ES6 - JavaCro 2016
Introduction to web programming for java and c# programmers by @drpicox
MCS First Year JavaScript ES6 Features.pdf
ES6: Features + Rails

More from Kobkrit Viriyayudhakorn (20)

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

Recently uploaded (20)

PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
L1 - Introduction to python Backend.pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
top salesforce developer skills in 2025.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
AI in Product Development-omnex systems
PDF
Nekopoi APK 2025 free lastest update
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Digital Strategies for Manufacturing Companies
PDF
medical staffing services at VALiNTRY
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Softaken Excel to vCard Converter Software.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
L1 - Introduction to python Backend.pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
top salesforce developer skills in 2025.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
AI in Product Development-omnex systems
Nekopoi APK 2025 free lastest update
Understanding Forklifts - TECH EHS Solution
VVF-Customer-Presentation2025-Ver1.9.pptx
Digital Strategies for Manufacturing Companies
medical staffing services at VALiNTRY
CHAPTER 2 - PM Management and IT Context
Adobe Illustrator 28.6 Crack My Vision of Vector Design
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms I-SECS-1021-03
How to Migrate SBCGlobal Email to Yahoo Easily
Navsoft: AI-Powered Business Solutions & Custom Software Development
Softaken Excel to vCard Converter Software.pdf

Lecture 3 - ES6 Script Advanced for React-Native