SlideShare a Scribd company logo
1 of 20
ECMAscript 6
ME
• Ofir Fridman
• FE Developer
• Love code, technology, sport
JavaScript History
• Beginnings at Netscape
• JavaScript was originally developed by Brendan Eich,
• The first version was completed in ten days
• JavaScript first called Mocha, which was later renamed
LiveScript in September 1995 and later JavaScript
The JavaScript Timeline
Browser Statistics
2015 Chrome IE Firefox Safari Opera
April 63.9 % 8.0 % 21.6 % 3.8 % 1.5 %
March 63.7 % 7.7 % 22.1 % 3.9 % 1.5 %
February 62.5 % 8.0 % 22.9 % 3.9 % 1.5 %
January 61.9 % 7.8 % 23.4 % 3.8 % 1.6 %
JavaScript Engine
• Google - Chrome - V8
• Mozila - FF – Spider Monkey
• Microsoft - IE - Chakra
• Apple – safari - SquirrelFish
Old New Browser Player
• Microsoft Edge (codenamed Spartan) is a web
browser under development by Microsoft.
The new var is let
let example
var arr1 = [];
for (var j = 0; j < 10; j++) {
arr1[j] = function () {
return j;
};
}
var arr1 = [];
for (var j = 0; j < 10; j++) {
(function (j) {
arr1[j] = function () {
return j;
};
})(j);
}
let arr = [];
for (let i = 0; i < 10; i++) {
arr[i] = function () {
return i;
};
}
Arrow Function
let square = x => x * x;
let add = (a, b) => a + b;
let pi = () => 3.1415;
console.log(square(5));
console.log(add(3, 4));
console.log(pi());
Arrow function example 1
Arrow Function
window.name = "Dog4";
function Dog(name){
this.name = name;
}
Dog.prototype.eat = function(){
setTimeout(function(){
console.log(`${this.name} eating`);
},300);
};
let d1 = new Dog('Dog1');
d1.eat();
window.name = "Dog4";
function Dog(name){
this.name = name;
}
Dog.prototype.eat = function(){
setTimeout(function(){
console.log(`${this.name} eating`);
}.bind(this),300);
};
let d2 = new Dog('Dog2');
d2.eat();
window.name = "Dog4";
function Dog(name){
this.name = name;
}
Dog.prototype.eat = function(){
setTimeout(() => {
console.log(`${this.name} eating`);
},300);
};
let d3 = new Dog('Dog3');
d3.eat();
Arrow function example 2
Class
// Animal constructor
function Animal(name) {
this.name = name;
}
// Adding walk method to Animal
Animal.prototype.walk = function () {
console.log(this.name + " is walking.");
};
// Dog constructor
function Dog(name, age) {
this.age = age;
// init Animal constructor
Animal.call(this, name);
}
// Inherit the Animal prototype (this create a copy of the prototype)
Dog.prototype = Object.create(Animal.prototype);
// Set the Dog constructor to 'Dog'
Dog.prototype.constructor = Dog;
var dog1 = new Dog("dog1", 3);
dog1.walk();
class Animal {
constructor(name) {
this.name = name;
}
walk() {
console.log(this.name + " is walking.");
}
}
class Dog extends Animal {
constructor(name,age) {
super(name); //call the parent method with super
this.age = age;
}
}
let dog1 = new Dog("dog1",3);
dog1.walk();
Class example
Class get and set
Class get, set example
class Person{
constructor(name){
this._name = name;
console.log(`${this._name} Created`);
}
run(){
console.log(`${this._name} is runing!`);
}
get name(){
console.log(`get this ${this._name} name`);
return this._name;
}
set name(name){
console.log(`set this ${name} name`);
this._name = name;
}
}
let p = new Person("ofir");
console.log(p.name);
p.name = "ofir fridman";
console.log(p.name);
Proxy
var p = new Proxy(target, handler);
let person = {
name: 'Ofir'
};
let handler = {
get: function (target, key) {
return `Hi ${target[key]}`;
}
};
person = new Proxy(person, handler);
console.log(person.name);
Get example 1
let person = {};
let handler = {
get: function (target, prop) {
if (prop in target) {
return target[prop];
}
target[prop] = new Proxy({}, handler);
return target[prop];
}
};
person = new Proxy(person, handler);
person.details.options.name = "ofir";
console.log(person.details.name);
Get example 2
*Note: current we can test it only in Firefox
Proxy
Set example
let person = {};
let handler = {
set: function (target, prop, value) {
if (prop === "id") {
throw new TypeError('You not allow to change id!!!');
}
if (prop === "age") {
if (!Number.isInteger(value)) {
throw new TypeError(`age should be integer. `);
}
}
if (prop === "name") {
target[prop] = value.charAt(0).toUpperCase() + value.slice(1);
}
}
};
person = new Proxy(person,handler);
person.name = "ofir";
console.log(person.name);
person.id = 123;
person.age = 12.2;
*Note: current we can test it only in Firefox
Iterators
Iterable
[1,2,n]
Iterator
next()
{value: 1, done: false}
{value: 2, done: false}
{value: n, done: false}
{value: n+1, done: true}
Example Iterators
let sum =0;
let numbers = [1,2,3,4];
let iterator = numbers.values();
let next = iterator.next();
while(!next.done){
sum += next.value;
next = iterator.next();
}
console.log(`sum = ${sum}`);
sum = 0;
for(let i of numbers){
sum += i;
}
console.log(`sum = ${sum}`);
ECMAScript 6 Features
• arrows
• classes
• enhanced object literals
• template strings
• destructuring
• default + rest + spread
• let + const
• iterators + for..of
• generators
• unicode
• modules
• module loaders
• map + set + weakmap + weakset
• proxies
• symbols
• subclassable built-ins
• promises
• math + number + string + array + object APIs
• binary and octal literals
• reflect api
• tail calls
ECMAScript 6 Browser Support
ECMAScript Playground
• ES6Fiddle
• BABEL
External links
Wikipedia
Brendan Eich
w3schools
Browser Statistics
JavaScript engine
You Tube
ECMAScript 6 - The Future is Here - Uri Shaked
ES6: A realistic use of proxies
MDN
Proxy
Classes
let
Arrow functions
Iterators and generators
Pluralsight
JavaScript Fundamentals for ES6
+ Slides
EcmaScript 6 Today! By Abdul Habrah
ECMAScript 6 with Kit Cambridge

More Related Content

What's hot

The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180Mahmoud Samir Fayed
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014Henning Jacobs
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful weddingStéphane Wirtel
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?Ben Hall
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181Mahmoud Samir Fayed
 
Smarter Testing with Spock
Smarter Testing with SpockSmarter Testing with Spock
Smarter Testing with SpockDmitry Voloshko
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Tsuyoshi Yamamoto
 
The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212Mahmoud Samir Fayed
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptSurvey Department
 
The Ring programming language version 1.5.4 book - Part 53 of 185
The Ring programming language version 1.5.4 book - Part 53 of 185The Ring programming language version 1.5.4 book - Part 53 of 185
The Ring programming language version 1.5.4 book - Part 53 of 185Mahmoud Samir Fayed
 
Indexing & query optimization
Indexing & query optimizationIndexing & query optimization
Indexing & query optimizationJared Rosoff
 
Frege is a Haskell for the JVM
Frege is a Haskell for the JVMFrege is a Haskell for the JVM
Frege is a Haskell for the JVMjwausle
 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestHoward Lewis Ship
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]Baruch Sadogursky
 
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189Mahmoud Samir Fayed
 
Zen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst ApplicationsZen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst ApplicationsJay Shirley
 

What's hot (20)

The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180The Ring programming language version 1.5.1 book - Part 44 of 180
The Ring programming language version 1.5.1 book - Part 44 of 180
 
Gatling.pptx
Gatling.pptxGatling.pptx
Gatling.pptx
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful wedding
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181
 
Smarter Testing with Spock
Smarter Testing with SpockSmarter Testing with Spock
Smarter Testing with Spock
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212
 
Object oriented JavaScript
Object oriented JavaScriptObject oriented JavaScript
Object oriented JavaScript
 
Lalal
LalalLalal
Lalal
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python Script
 
The Ring programming language version 1.5.4 book - Part 53 of 185
The Ring programming language version 1.5.4 book - Part 53 of 185The Ring programming language version 1.5.4 book - Part 53 of 185
The Ring programming language version 1.5.4 book - Part 53 of 185
 
Indexing & query optimization
Indexing & query optimizationIndexing & query optimization
Indexing & query optimization
 
Frege is a Haskell for the JVM
Frege is a Haskell for the JVMFrege is a Haskell for the JVM
Frege is a Haskell for the JVM
 
ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189
 
Zen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst ApplicationsZen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst Applications
 

Viewers also liked

HTML5 and SVG
HTML5 and SVGHTML5 and SVG
HTML5 and SVGyarcub
 
Interactive Vector-Graphics in the Browser
Interactive Vector-Graphics in the BrowserInteractive Vector-Graphics in the Browser
Interactive Vector-Graphics in the Browsertec
 
HTML Canvas tips & tricks - Lightning Talk by Roman Rodych
 HTML Canvas tips & tricks - Lightning Talk by Roman Rodych HTML Canvas tips & tricks - Lightning Talk by Roman Rodych
HTML Canvas tips & tricks - Lightning Talk by Roman RodychPivorak MeetUp
 
【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率NIED
 
Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Peter Lubbers
 
HTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the WebHTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the WebRobin Hawkes
 
Rucksack 裝滿神奇 css 的後背包
Rucksack 裝滿神奇 css 的後背包Rucksack 裝滿神奇 css 的後背包
Rucksack 裝滿神奇 css 的後背包Anna Su
 
從一個超簡單範例開始學習 Canvas
從一個超簡單範例開始學習 Canvas從一個超簡單範例開始學習 Canvas
從一個超簡單範例開始學習 CanvasAnna Su
 

Viewers also liked (14)

HTML 5_Canvas
HTML 5_CanvasHTML 5_Canvas
HTML 5_Canvas
 
HTML 5 Canvas & SVG
HTML 5 Canvas & SVGHTML 5 Canvas & SVG
HTML 5 Canvas & SVG
 
Canvas - HTML 5
Canvas - HTML 5Canvas - HTML 5
Canvas - HTML 5
 
HTML5 and SVG
HTML5 and SVGHTML5 and SVG
HTML5 and SVG
 
Working With Canvas
Working With CanvasWorking With Canvas
Working With Canvas
 
HTML CANVAS
HTML CANVASHTML CANVAS
HTML CANVAS
 
Canvas & Charts
Canvas & ChartsCanvas & Charts
Canvas & Charts
 
Interactive Vector-Graphics in the Browser
Interactive Vector-Graphics in the BrowserInteractive Vector-Graphics in the Browser
Interactive Vector-Graphics in the Browser
 
HTML Canvas tips & tricks - Lightning Talk by Roman Rodych
 HTML Canvas tips & tricks - Lightning Talk by Roman Rodych HTML Canvas tips & tricks - Lightning Talk by Roman Rodych
HTML Canvas tips & tricks - Lightning Talk by Roman Rodych
 
【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率
 
Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)
 
HTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the WebHTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the Web
 
Rucksack 裝滿神奇 css 的後背包
Rucksack 裝滿神奇 css 的後背包Rucksack 裝滿神奇 css 的後背包
Rucksack 裝滿神奇 css 的後背包
 
從一個超簡單範例開始學習 Canvas
從一個超簡單範例開始學習 Canvas從一個超簡單範例開始學習 Canvas
從一個超簡單範例開始學習 Canvas
 

Similar to ES6

ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015qmmr
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript FunctionsBrian Moschel
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The LandingHaci Murat Yaman
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairCoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairMark
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeLaurence Svekis ✔
 
JavaScript in 2015
JavaScript in 2015JavaScript in 2015
JavaScript in 2015Igor Laborie
 
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...Tim Chaplin
 
Best of build 2021 - C# 10 & .NET 6
Best of build 2021 -  C# 10 & .NET 6Best of build 2021 -  C# 10 & .NET 6
Best of build 2021 - C# 10 & .NET 6Moaid Hathot
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScriptMichael Girouard
 
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony CodeGroovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Codestasimus
 
React Native Evening
React Native EveningReact Native Evening
React Native EveningTroy Miles
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leetjohndaviddalton
 
JavaScript Proven Practises
JavaScript Proven PractisesJavaScript Proven Practises
JavaScript Proven PractisesRobert MacLean
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionHans Höchtl
 

Similar to ES6 (20)

ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript Functions
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
Es6 hackathon
Es6 hackathonEs6 hackathon
Es6 hackathon
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairCoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love Affair
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
 
JavaScript in 2015
JavaScript in 2015JavaScript in 2015
JavaScript in 2015
 
Learnjs
LearnjsLearnjs
Learnjs
 
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...Fullstack Conference -  Proxies before proxies: The hidden gems of Javascript...
Fullstack Conference - Proxies before proxies: The hidden gems of Javascript...
 
Best of build 2021 - C# 10 & .NET 6
Best of build 2021 -  C# 10 & .NET 6Best of build 2021 -  C# 10 & .NET 6
Best of build 2021 - C# 10 & .NET 6
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Groovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony CodeGroovy vs Boilerplate and Ceremony Code
Groovy vs Boilerplate and Ceremony Code
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leet
 
JavaScript Proven Practises
JavaScript Proven PractisesJavaScript Proven Practises
JavaScript Proven Practises
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Oojs 1.1
Oojs 1.1Oojs 1.1
Oojs 1.1
 
Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript
 

Recently uploaded

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

ES6

  • 2. ME • Ofir Fridman • FE Developer • Love code, technology, sport
  • 3. JavaScript History • Beginnings at Netscape • JavaScript was originally developed by Brendan Eich, • The first version was completed in ten days • JavaScript first called Mocha, which was later renamed LiveScript in September 1995 and later JavaScript
  • 5. Browser Statistics 2015 Chrome IE Firefox Safari Opera April 63.9 % 8.0 % 21.6 % 3.8 % 1.5 % March 63.7 % 7.7 % 22.1 % 3.9 % 1.5 % February 62.5 % 8.0 % 22.9 % 3.9 % 1.5 % January 61.9 % 7.8 % 23.4 % 3.8 % 1.6 %
  • 6. JavaScript Engine • Google - Chrome - V8 • Mozila - FF – Spider Monkey • Microsoft - IE - Chakra • Apple – safari - SquirrelFish
  • 7.
  • 8. Old New Browser Player • Microsoft Edge (codenamed Spartan) is a web browser under development by Microsoft.
  • 9. The new var is let let example var arr1 = []; for (var j = 0; j < 10; j++) { arr1[j] = function () { return j; }; } var arr1 = []; for (var j = 0; j < 10; j++) { (function (j) { arr1[j] = function () { return j; }; })(j); } let arr = []; for (let i = 0; i < 10; i++) { arr[i] = function () { return i; }; }
  • 10. Arrow Function let square = x => x * x; let add = (a, b) => a + b; let pi = () => 3.1415; console.log(square(5)); console.log(add(3, 4)); console.log(pi()); Arrow function example 1
  • 11. Arrow Function window.name = "Dog4"; function Dog(name){ this.name = name; } Dog.prototype.eat = function(){ setTimeout(function(){ console.log(`${this.name} eating`); },300); }; let d1 = new Dog('Dog1'); d1.eat(); window.name = "Dog4"; function Dog(name){ this.name = name; } Dog.prototype.eat = function(){ setTimeout(function(){ console.log(`${this.name} eating`); }.bind(this),300); }; let d2 = new Dog('Dog2'); d2.eat(); window.name = "Dog4"; function Dog(name){ this.name = name; } Dog.prototype.eat = function(){ setTimeout(() => { console.log(`${this.name} eating`); },300); }; let d3 = new Dog('Dog3'); d3.eat(); Arrow function example 2
  • 12. Class // Animal constructor function Animal(name) { this.name = name; } // Adding walk method to Animal Animal.prototype.walk = function () { console.log(this.name + " is walking."); }; // Dog constructor function Dog(name, age) { this.age = age; // init Animal constructor Animal.call(this, name); } // Inherit the Animal prototype (this create a copy of the prototype) Dog.prototype = Object.create(Animal.prototype); // Set the Dog constructor to 'Dog' Dog.prototype.constructor = Dog; var dog1 = new Dog("dog1", 3); dog1.walk(); class Animal { constructor(name) { this.name = name; } walk() { console.log(this.name + " is walking."); } } class Dog extends Animal { constructor(name,age) { super(name); //call the parent method with super this.age = age; } } let dog1 = new Dog("dog1",3); dog1.walk(); Class example
  • 13. Class get and set Class get, set example class Person{ constructor(name){ this._name = name; console.log(`${this._name} Created`); } run(){ console.log(`${this._name} is runing!`); } get name(){ console.log(`get this ${this._name} name`); return this._name; } set name(name){ console.log(`set this ${name} name`); this._name = name; } } let p = new Person("ofir"); console.log(p.name); p.name = "ofir fridman"; console.log(p.name);
  • 14. Proxy var p = new Proxy(target, handler); let person = { name: 'Ofir' }; let handler = { get: function (target, key) { return `Hi ${target[key]}`; } }; person = new Proxy(person, handler); console.log(person.name); Get example 1 let person = {}; let handler = { get: function (target, prop) { if (prop in target) { return target[prop]; } target[prop] = new Proxy({}, handler); return target[prop]; } }; person = new Proxy(person, handler); person.details.options.name = "ofir"; console.log(person.details.name); Get example 2 *Note: current we can test it only in Firefox
  • 15. Proxy Set example let person = {}; let handler = { set: function (target, prop, value) { if (prop === "id") { throw new TypeError('You not allow to change id!!!'); } if (prop === "age") { if (!Number.isInteger(value)) { throw new TypeError(`age should be integer. `); } } if (prop === "name") { target[prop] = value.charAt(0).toUpperCase() + value.slice(1); } } }; person = new Proxy(person,handler); person.name = "ofir"; console.log(person.name); person.id = 123; person.age = 12.2; *Note: current we can test it only in Firefox
  • 16. Iterators Iterable [1,2,n] Iterator next() {value: 1, done: false} {value: 2, done: false} {value: n, done: false} {value: n+1, done: true} Example Iterators let sum =0; let numbers = [1,2,3,4]; let iterator = numbers.values(); let next = iterator.next(); while(!next.done){ sum += next.value; next = iterator.next(); } console.log(`sum = ${sum}`); sum = 0; for(let i of numbers){ sum += i; } console.log(`sum = ${sum}`);
  • 17. ECMAScript 6 Features • arrows • classes • enhanced object literals • template strings • destructuring • default + rest + spread • let + const • iterators + for..of • generators • unicode • modules • module loaders • map + set + weakmap + weakset • proxies • symbols • subclassable built-ins • promises • math + number + string + array + object APIs • binary and octal literals • reflect api • tail calls
  • 20. External links Wikipedia Brendan Eich w3schools Browser Statistics JavaScript engine You Tube ECMAScript 6 - The Future is Here - Uri Shaked ES6: A realistic use of proxies MDN Proxy Classes let Arrow functions Iterators and generators Pluralsight JavaScript Fundamentals for ES6 + Slides EcmaScript 6 Today! By Abdul Habrah ECMAScript 6 with Kit Cambridge