SlideShare une entreprise Scribd logo
1  sur  60
Télécharger pour lire hors ligne
ES2015 / ES6
Basics of modern JavaScript
Wojciech Dzikowski
@DzikowskiW
• working remotely for a software startup Folium
Partners since 2011
• we create software for ebook and audiobook
publishers
• Software engineer : JavaScript, PHP (Symfony 2),
Android, OS X / iOS
• contact: @DzikowskiW
Wojciech Dzikowski
Agenda
1. Evolution of JavaScript
2. Main goals of JavaScript and ES6
3. ES6 in practice (selected features)
4. Q&A
Dictionary
• JavaScript (JS) - a high-level, dynamic, untyped, and interpreted
programming language created originally for web browsers, ECMAScript
implementation
• ECMA International - an international non-profit standards organization
for information and communication systems.It acquired its current name in
1994, when the European Computer Manufacturers Association (ECMA)
changed its name to reflect the organization's global reach and activities
• ECMAScript (ES)- scripting-language specification standardized by
Ecma International in ECMA-262 and ISO/IEC 16262. Well-known
implementations of the language, such as JavaScript, JScript and
ActionScript have come into wide use for client-side scripting on the Web
• ES2015 (ES6) - the newest version of ECMAScript
Language Evolution
90s
• 1995: Netscape creates Mocha
• 1995: Mocha -> LiveScript -> JavaScript
• 1996: ECMA adopts JavaScript
• 1997: ECMA-262 (ES1)
• 1998: ES2
• 1999: ES3 (regex, try/catch)
90s
• browser wars IE vs Netscape
• DHTML, “animate everything”
• forms validation
• visitor counters
• code had to be optimised per browser (IE vs Netscape)
2000-2004
• browser wars - IE wins
• not much going on in JS world
2005: AJAX
• Broadband Internet becomes popular
• Asynchronus server requests (AJAX) becomes popular
• renaissance of JavaScript
• countless libraries (mainly helping with AJAX requests
and DOM operations)
2006-2009
• 2008: ECMAScript4 (abandoned)
• 2009: ECMAScript 3.1 5 (strict, JSON, Reflect)
• 2009: servers welcome JavaScript: Node.js
2010-2015
• frameworks evolution, no longer just DOM & AJAX
helpers
• JS packet managers: npm, bower
• solutions for keeping code in modules (node.js,
CommonJS, AMD, Browserify)
• JavaScript preprocessors (Grunt, Gulp, Webpack,…)
Now
• 2015: ECMAScript 2015 (lots of features)
• since 2015 a new ES spec will be released each
year
• upcoming: ES2016 (no major changes)
2016
Web browser
Desktop Apps
Server
Mobile Apps
JavaScript - pros
• easy syntax
• functions are objects (awesome!)
• independent from any big company
• the only native web browser language
• big and vibrant community
• lots of helpful tools, libraries and frameworks
JavaScript
JavaScript ≠ Java
Guinea pig ≠ pig
≠
≠
JavaScript - cons
(subjective list)
• differences in comparison to Java-like
languages can create confusion (prototypes vs
classes,function scope vs block scope, hoisting, +,
…)
JavaScript - cons
(subjective list)
• not many unequivocal clean code practices (each
framework = new practices, enforcing bad
practices can be harmful to community)
• very rapid development often makes tools and
frameworks obsolete fast, it is hard to choose
frameworks and tools for apps that need to be
maintained for years
Main goals of ES6
• fix (some of) ES5 problems
• backwards compatibility (ES5 code is valid in
ES6)
• modern syntax
• better suited for big applications
• new features in standard library
ES6 -today
kangax.github.io/compat-table
ES6 in browsers today
• ES6 => ES5 transpilers
Babel - usage
• command line:
$ babel es6.js -o es5.js
• Online:
• Konfigurator: http://babeljs.io/docs/setup/
Babel - użycie
• Online wizard: http://babeljs.io/docs/setup/
ES6 in practice
ES5: var
ES5: var - hoisting
ES6: let is new var
ES5…
…ES6: const
ES5: concatenation
ES5: long strings
ES6: Template strings
ES6: Object declarations
ES6: Classes
ES6: Classes
ES6: Setters & getters
ES6: Default params
ES5 recap: map
el
ES5 recap: filter
ES5 recap: reduce
ES6: Arrow functions
ES6: Arrow functions
Arrow functions: this
ES5: for … in
• best practice: avoid that loop
ES6: for … of
• for … of can iterate not only over arrays
• Homework: Iterators in ES6
Asynchronus programming
• common in JS (animations, server requests, etc.)
• Classic solution: callback
• Problem: only one callback per async task
Async programming, ES5
• Problem: Nested functions create messy code
Async programming, ES5
• Second try: Listeners
• Problem: no reaction when async function ends before
listener registers, often hard to debug
ES6: Promise
• object that keeps a result of an async function (waiting,
resolved, rejected)
• fixes earlier problem with listeners, since callback is called even
if async function completed the task earlier
• allows to return (Promise) objects and work with them, even if
async function is still not completed (better code readability)
• “promises” that it will get resolved
• uses Observer pattern to populate the result
• flattens nested promises to avoid “callback hell”
Promises
Promise
• waiting
• resolved
• rejected
States:
async function
Listener 1
Listener 2
Listener 3
Promises
Callback hell, ES5
Promises
Modules (ES5)
• IIFE (Immediately Invoked Function Expression)
• controls variable exposure
Modules (ES6) in browser
• use tools such as Browserify / Webpack,
• native ES6 modules are not yet implemented
What we have learned?
• let/const
• template strings
• new ways to declare objects
• classes
• map, filter, reduce (ES5)
• arrow functions
• for … of
• Promises
• Modules
Other ES6 features
• Proxy
• Iterators
• Generators
• Symbols
• Map/Set, WeakMap/WeakSet
• extended standard library (Number, Math, Array)
Summary
• use transpilers (Babel) to write ES6 today for any
browser
• learn ES6 step by step, you don’t have to know
everything at once
• many features are syntactic sugar, use with
moderation
• ES6 is now, go learn it!
What next?
• Babel docs: https://babeljs.io/docs/learn-es2015/
• Mozilla docs: http://developer.mozilla.org/en-US/
docs/Web/JavaScript
• ES specs: https://github.com/tc39/ecma262
• Pluralsight: JavaScript Fundamentals for ES6
• Youtube: FunFunFunction
Q&A

Contenu connexe

Tendances

JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and StatementsWebStackAcademy
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentationThanh Tuong
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and FunctionsJussi Pohjolainen
 
React-JS Component Life-cycle Methods
React-JS Component Life-cycle MethodsReact-JS Component Life-cycle Methods
React-JS Component Life-cycle MethodsANKUSH CHAVAN
 
What is component in reactjs
What is component in reactjsWhat is component in reactjs
What is component in reactjsmanojbkalla
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorialMohammed Fazuluddin
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxMalla Reddy University
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practicesfelixbillon
 
Modern UI Development With Node.js
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.jsRyan Anklam
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom ManipulationMohammed Arif
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners Varun Raj
 

Tendances (20)

Javascript 101
Javascript 101Javascript 101
Javascript 101
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
React-JS Component Life-cycle Methods
React-JS Component Life-cycle MethodsReact-JS Component Life-cycle Methods
React-JS Component Life-cycle Methods
 
What is component in reactjs
What is component in reactjsWhat is component in reactjs
What is component in reactjs
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
 
Json Tutorial
Json TutorialJson Tutorial
Json Tutorial
 
Json
JsonJson
Json
 
TypeScript Best Practices
TypeScript Best PracticesTypeScript Best Practices
TypeScript Best Practices
 
jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Modern UI Development With Node.js
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.js
 
React js
React jsReact js
React js
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 

En vedette

ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]Guillermo Paz
 
Lecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-NativeLecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-NativeKobkrit Viriyayudhakorn
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overviewhesher
 
객체지향 철학 그리고 5대 개념
객체지향 철학 그리고 5대 개념객체지향 철학 그리고 5대 개념
객체지향 철학 그리고 5대 개념중선 곽
 
객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)Seung-June Lee
 

En vedette (6)

ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]
 
Lecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-NativeLecture 3 - ES6 Script Advanced for React-Native
Lecture 3 - ES6 Script Advanced for React-Native
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
객체지향 철학 그리고 5대 개념
객체지향 철학 그리고 5대 개념객체지향 철학 그리고 5대 개념
객체지향 철학 그리고 5대 개념
 
객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)객체지향 개념 (쫌 아는체 하기)
객체지향 개념 (쫌 아는체 하기)
 

Similaire à ES2015 / ES6: Basics of modern Javascript

Product Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical SkillsProduct Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical SkillsSandeep Adwankar
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
MOBILE QUESTIONS & ANSWER WEBSITE
MOBILE QUESTIONS & ANSWER WEBSITEMOBILE QUESTIONS & ANSWER WEBSITE
MOBILE QUESTIONS & ANSWER WEBSITEVishal Mittal
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
Structured web apps
Structured web appsStructured web apps
Structured web appsSheng Tian
 
MWLUG - Universal Java
MWLUG  -  Universal JavaMWLUG  -  Universal Java
MWLUG - Universal JavaPhilippe Riand
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...IncQuery Labs
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachPROIDEA
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Nuxeo
 
Upgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcutUpgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcutChristian Heilmann
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesJesse Gallagher
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteChristian Heilmann
 
Lecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastLecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastUzairSaeed18
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANJeff Fox
 

Similaire à ES2015 / ES6: Basics of modern Javascript (20)

Product Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical SkillsProduct Camp Silicon Valley 2018 - PM Technical Skills
Product Camp Silicon Valley 2018 - PM Technical Skills
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
MOBILE QUESTIONS & ANSWER WEBSITE
MOBILE QUESTIONS & ANSWER WEBSITEMOBILE QUESTIONS & ANSWER WEBSITE
MOBILE QUESTIONS & ANSWER WEBSITE
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Structured web apps
Structured web appsStructured web apps
Structured web apps
 
History of Java 1/2
History of Java 1/2History of Java 1/2
History of Java 1/2
 
Java (1)
Java (1)Java (1)
Java (1)
 
Case study
Case studyCase study
Case study
 
MWLUG - Universal Java
MWLUG  -  Universal JavaMWLUG  -  Universal Java
MWLUG - Universal Java
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
 
Java Introduction
Java IntroductionJava Introduction
Java Introduction
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Upgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcutUpgrading JavaScript to ES6 and using TypeScript as a shortcut
Upgrading JavaScript to ES6 and using TypeScript as a shortcut
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPages
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynote
 
Lecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 FastLecture-01 _Java Introduction CS 441 Fast
Lecture-01 _Java Introduction CS 441 Fast
 
JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 

Dernier

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 

Dernier (20)

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 

ES2015 / ES6: Basics of modern Javascript

  • 1. ES2015 / ES6 Basics of modern JavaScript Wojciech Dzikowski @DzikowskiW
  • 2. • working remotely for a software startup Folium Partners since 2011 • we create software for ebook and audiobook publishers • Software engineer : JavaScript, PHP (Symfony 2), Android, OS X / iOS • contact: @DzikowskiW Wojciech Dzikowski
  • 3. Agenda 1. Evolution of JavaScript 2. Main goals of JavaScript and ES6 3. ES6 in practice (selected features) 4. Q&A
  • 4. Dictionary • JavaScript (JS) - a high-level, dynamic, untyped, and interpreted programming language created originally for web browsers, ECMAScript implementation • ECMA International - an international non-profit standards organization for information and communication systems.It acquired its current name in 1994, when the European Computer Manufacturers Association (ECMA) changed its name to reflect the organization's global reach and activities • ECMAScript (ES)- scripting-language specification standardized by Ecma International in ECMA-262 and ISO/IEC 16262. Well-known implementations of the language, such as JavaScript, JScript and ActionScript have come into wide use for client-side scripting on the Web • ES2015 (ES6) - the newest version of ECMAScript
  • 6. 90s • 1995: Netscape creates Mocha • 1995: Mocha -> LiveScript -> JavaScript • 1996: ECMA adopts JavaScript • 1997: ECMA-262 (ES1) • 1998: ES2 • 1999: ES3 (regex, try/catch)
  • 7. 90s • browser wars IE vs Netscape • DHTML, “animate everything” • forms validation • visitor counters • code had to be optimised per browser (IE vs Netscape)
  • 8. 2000-2004 • browser wars - IE wins • not much going on in JS world
  • 9. 2005: AJAX • Broadband Internet becomes popular • Asynchronus server requests (AJAX) becomes popular • renaissance of JavaScript • countless libraries (mainly helping with AJAX requests and DOM operations)
  • 10. 2006-2009 • 2008: ECMAScript4 (abandoned) • 2009: ECMAScript 3.1 5 (strict, JSON, Reflect) • 2009: servers welcome JavaScript: Node.js
  • 11. 2010-2015 • frameworks evolution, no longer just DOM & AJAX helpers • JS packet managers: npm, bower • solutions for keeping code in modules (node.js, CommonJS, AMD, Browserify) • JavaScript preprocessors (Grunt, Gulp, Webpack,…)
  • 12. Now • 2015: ECMAScript 2015 (lots of features) • since 2015 a new ES spec will be released each year • upcoming: ES2016 (no major changes)
  • 14. JavaScript - pros • easy syntax • functions are objects (awesome!) • independent from any big company • the only native web browser language • big and vibrant community • lots of helpful tools, libraries and frameworks
  • 16. JavaScript ≠ Java Guinea pig ≠ pig ≠ ≠
  • 17. JavaScript - cons (subjective list) • differences in comparison to Java-like languages can create confusion (prototypes vs classes,function scope vs block scope, hoisting, +, …)
  • 18. JavaScript - cons (subjective list) • not many unequivocal clean code practices (each framework = new practices, enforcing bad practices can be harmful to community) • very rapid development often makes tools and frameworks obsolete fast, it is hard to choose frameworks and tools for apps that need to be maintained for years
  • 19. Main goals of ES6 • fix (some of) ES5 problems • backwards compatibility (ES5 code is valid in ES6) • modern syntax • better suited for big applications • new features in standard library
  • 21. ES6 in browsers today • ES6 => ES5 transpilers
  • 22. Babel - usage • command line: $ babel es6.js -o es5.js • Online: • Konfigurator: http://babeljs.io/docs/setup/
  • 23. Babel - użycie • Online wizard: http://babeljs.io/docs/setup/
  • 26. ES5: var - hoisting
  • 27. ES6: let is new var
  • 36. ES6: Setters & getters
  • 44. ES5: for … in • best practice: avoid that loop
  • 45. ES6: for … of • for … of can iterate not only over arrays • Homework: Iterators in ES6
  • 46. Asynchronus programming • common in JS (animations, server requests, etc.) • Classic solution: callback • Problem: only one callback per async task
  • 47. Async programming, ES5 • Problem: Nested functions create messy code
  • 48. Async programming, ES5 • Second try: Listeners • Problem: no reaction when async function ends before listener registers, often hard to debug
  • 49. ES6: Promise • object that keeps a result of an async function (waiting, resolved, rejected) • fixes earlier problem with listeners, since callback is called even if async function completed the task earlier • allows to return (Promise) objects and work with them, even if async function is still not completed (better code readability) • “promises” that it will get resolved • uses Observer pattern to populate the result • flattens nested promises to avoid “callback hell”
  • 50. Promises Promise • waiting • resolved • rejected States: async function Listener 1 Listener 2 Listener 3
  • 54. Modules (ES5) • IIFE (Immediately Invoked Function Expression) • controls variable exposure
  • 55. Modules (ES6) in browser • use tools such as Browserify / Webpack, • native ES6 modules are not yet implemented
  • 56. What we have learned? • let/const • template strings • new ways to declare objects • classes • map, filter, reduce (ES5) • arrow functions • for … of • Promises • Modules
  • 57. Other ES6 features • Proxy • Iterators • Generators • Symbols • Map/Set, WeakMap/WeakSet • extended standard library (Number, Math, Array)
  • 58. Summary • use transpilers (Babel) to write ES6 today for any browser • learn ES6 step by step, you don’t have to know everything at once • many features are syntactic sugar, use with moderation • ES6 is now, go learn it!
  • 59. What next? • Babel docs: https://babeljs.io/docs/learn-es2015/ • Mozilla docs: http://developer.mozilla.org/en-US/ docs/Web/JavaScript • ES specs: https://github.com/tc39/ecma262 • Pluralsight: JavaScript Fundamentals for ES6 • Youtube: FunFunFunction
  • 60. Q&A