SlideShare a Scribd company logo
1 of 30
ESWow!
A overly-broad overview of JavaScript ES6
ES6 Background
ECMAScript
December 1995: JavaScript announced by Sun
March 1996: Shipped in Netscape Navigator 2.0
November 1996: Netscape presents Ecma-262 to ECMA International
European Computer Manufacturers Association
FAT12/FAT16
CD-ROM
C# language spec
ECMAScript
JSON
June 1997: ECMAScript v1 is adopted
ES Versions
V1 - 1997
V2 - 1998
V3 - 1999
Add regex, try/catch
V4 - N/A
Abandoned
V5 - 2009
Adds “strict mode”, JSON support, reflection
V6 - 2015
Woohoo!
V7 - 2016
Array.prototype.includes(), **
ESPanorama
The use it now features
Block-scoped variables: let, const
if(true) {
var answer = 42;
}
answer;
>> 42
if(true) {
let answer = 42;
}
answer;
>> ReferenceError: answer is not defined
ES5 ES6
Self-invoking functions
(function() {
console.log(“hi”);
})();
{
console.log(“hi”);
}
ES5 ES6
Arrow functions
[1, 2, 3, 4, 5].map(function(num) {
return num * 2;
});
-------
this.thing = “thing”;
[1, 2].forEach(function() {
console.log(this.thing);
});
>> undefined
>> undefined
[1, 2, 3, 4, 5].map(num => num * 2);
[1, 2, 3, 4].map((number, index) => {
return number * index;
});
-------
this.thing = “thing”;
[1, 2].forEach(() => {
console.log(this.thing);
});
>> thing
>> thing
ES5 ES6
Method properties
var log = {
info: function(message) {
console.log("INFO: " + message);
},
warn: function(message) {
console.log("WARN: " + message);
}
};
log.info(“ES6”);
>> INFO: ES6
var log = {
info(message) {
console.log("INFO: " + message);
},
warn(message) {
console.log("WARN: " + message);
}
};
log.info(“ES6”);
>> INFO: ES6
ES5 ES6
Computed property names
var object = {};
object[4 + 2] = “6”;
{ 6: “6” }
var object = {
[4 + 2]: “6”
};
{ 6: “6” }
ES5 ES6
Property shorthand
var answer = 42;
{ answer: answer };
>> { answer: 42 }
var answer = 42;
{ answer };
>> { answer: 42}
ES5 ES6
Array.prototype.includes()
var array = [1, 2, 3, 4, 5];
function includes(element, array) {
Return array.indexOf(element) !== -1;
}
includes(3, array);
>> true
var array = [1, 2, 3, 4, 5];
array.includes(3);
>> true
ES5 ES6
String.prototype.includes()
var string = “Hi team”;
Function includes(string, substring) {
return string.indexOf(substring) !== -1;
}
includes(string, “team”);
>> true
var string = “Hi team”;
string.includes(“team”);
>> true
ES5 ES6
For… of
Var array = [1, 2, 3];
for(var i = 0; i < array.length; i++) {
console.log(array[i]);
}
>> 1
>> 2
>> 3
Var array = [1, 2, 3];
for(let number of array) {
console.log(number);
}
>> 1
>> 2
>> 3
ES5 ES6
Object.assign()
function assign() {
var target = arguments[0];
var sources = Array
.prototype
.slice
.call(arguments, 1);
sources.forEach(function(source) {
for(var property in source) {
if(source.hasOwnProperty(property)) {
target[property] = source[property];
}
}
});
return target;
};
assign({}, {hi: 1}, {bye: 2});
>> { hi: 1, bye: 2 }
Object.assign({}, { hi: 1 }, { bye: 2 })
>> { hi: 1, bye: 2 }
ES5 ES6
The ruby rip-off features
String interpolation
let name = “Rick”;
`Hi ${name}`
>> Hi Rick
Array.prototype.find()
[1, 2, 3, 4].find(num => num === 2);
>> 2
String.prototype.repeat()
“hi”.repeat(5);
>> hihihihihi
Fun fact:
“5” * 2
>> 10
The worth consideration features
Worth consideration
Number.EPSILON
Set/WeakSet
Map/WeakMap
Class syntax
Getters/setters
import
The crazytown features
Proxying
let object = {
person: "rick"
};
let proxy = new Proxy(object, {
get(target, name) {
return "hi " + target[name];
}
});
object.person
"rick"
>> proxy.person
"hi rick";
Symbols
let name = Symbol();
let type = Symbol();
let object = {};
object[name] = "RicksObject";
object[type] = "Object";
object
>> {}
object.name
undefined
object[name]
>> "RicksObject"
Unicode regex
/u{1F4BB}/u.test("💻")
>> true
Deploying ES6 at Panorama
Babel
sprockets-es6
ESQuestions?

More Related Content

Similar to ESWow! - Intro to JavaScript ES6

ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015
qmmr
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6
Solution4Future
 

Similar to ESWow! - Intro to JavaScript ES6 (20)

Beauty and the beast - Haskell on JVM
Beauty and the beast  - Haskell on JVMBeauty and the beast  - Haskell on JVM
Beauty and the beast - Haskell on JVM
 
Eta
EtaEta
Eta
 
GeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheetGeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheet
 
JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8JavaScript Editions ES7, ES8 and ES9 vs V8
JavaScript Editions ES7, ES8 and ES9 vs V8
 
Es6 hackathon
Es6 hackathonEs6 hackathon
Es6 hackathon
 
Impress Your Friends with EcmaScript 2015
Impress Your Friends with EcmaScript 2015Impress Your Friends with EcmaScript 2015
Impress Your Friends with EcmaScript 2015
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript
 
ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
[React Native Tutorial] Lecture 3: More on ES6/ES2015
[React Native Tutorial] Lecture 3: More on ES6/ES2015[React Native Tutorial] Lecture 3: More on ES6/ES2015
[React Native Tutorial] Lecture 3: More on ES6/ES2015
 
"let ECMAScript = 6"
"let ECMAScript = 6" "let ECMAScript = 6"
"let ECMAScript = 6"
 
Short intro to ES6 Features
Short intro to ES6 FeaturesShort intro to ES6 Features
Short intro to ES6 Features
 
ES6 and AngularAMD
ES6 and AngularAMDES6 and AngularAMD
ES6 and AngularAMD
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6
 
What is new in Java 8
What is new in Java 8What is new in Java 8
What is new in Java 8
 
ECMA Script
ECMA ScriptECMA Script
ECMA Script
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation Javascript
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is here
 
An Intro To ES6
An Intro To ES6An Intro To ES6
An Intro To ES6
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 

ESWow! - Intro to JavaScript ES6