SlideShare une entreprise Scribd logo
1  sur  20
JavaScript Code Academy
Introduction
Welcome!
And you?
Course content
Course content
Every week on Wednesday, eight sessions
Starting at 6 pm, 20 mins for asking, 6:30 pm presentation & coding
Syllabus (might be adjusted to your needs)
React.js basics
Unit testing
Managing application state
Dealing with async
Today ...
Introduction
Git, Github, Discussion forum
Brief JavaScript history & glossary
Setup environment
JavaScript basics
Git, Github, coding ...
All materials & code on Github: https://github.com/msd-code-academy
Discussion: http://discourse.js-code-academy.eu/
Common flow:
a. Fork the original repository
b. Clone it on your machine
c. Create feature branch
d. Push changes & create pull request
Do It!
- Install git
- Create Github account
- Register at discourse.js-code-academy.eu
Brief intro to JavaScript history & glossary
JavaScript history & glossary
Developed in 10 days at Netscape by Brendan Eich
Called Mocha -> LiveScript -> JavaScript
JavaScript - marketing name (because Java was cool back then)
EcmaScript - standard
Versioning: 1, 2, 3, 4, 5, 5.1, 6 => 2015, 7 => 2016
Node.js - JavaScript interpreter for server
Do it!
Setup your environment: https://github.com/msd-code-
academy/lessons/blob/master/introduction/environment.md
JavaScript basics
JavaScript right now...
JavaScript basics - functions
function returnSomething(param) {
Return 'I am hoisted';
}
var anonymous = function() {
return 'I am anonymous';
};
const fatArrow = () => 'I am lambda & ES6 only!';
new Function('a', 'b', 'return a + b'); // don't do it
JavaScript basics - functions & scope
var getA = function() {
var a = 'AAA';
var hello = 'Hello!';
var getB = function() {
var b = 'BBB';
var getC =
function() {
var c =
'CCC';
var hello
= 'Hi!';
console.log(a, b, c);
console.log(hello);
};
getC();
each function defines new scope
code in inner (child) scope can access
variables defined in outer (parent) scope
variables defined in current scope take
precedence over variables in parent
scope
JavaScript basics - higher order functions
Functions are just regular values:
They can be passed as an argument to other
functions
Function can return another function
=> might help you with abstraction
names.map(
(name) => name.substr(0, 1).toUpperCase() + name.substr(1)
)
const newNames = [];
for (var i = 0; i < names.length; i++){
const name = names[i]
const newName = name
.substr(0,1)
.toUpperCase() + name.substr(1);
newNames.push(newName);
}
JavaScript basics - this identifier
Refers to the “context” in which the function is called
It’s not the reference to scope
Any sufficiently advanced technology is indistinguishable from magic. -- Arthur C. Clarke
const hasClass = function (className) {
return this.classList.contains(className);
};
const e = document.querySelector('#elem');
hasClass.call(e);
hasClass.call({}); // Cannot read property 'contains' of undefined
const imprisoned = hasClass.bind(e);
imprisoned();
JavaScript basics - this identifier & fat arrow function
Fat arrow function binds the context at the creation, that’s it:
class Anderson {
constructor() {
this.name = 'Neo';
this.getName = () => this.name;
this.getName2 = function () {
return this.name;
};
}
}
const a = new Anderson();
const getName = a.getName;
const getName2 = a.getName2;
console.log(getName());
console.log(getName2()); // Error: Cannot read property 'name' of undefined, Matrix down
Do It!
Fork, clone, fix, push:
https://github.com/msd-code-
academy/lessons/blob/master/introduction/intro_to_js.md#javascript
-crash-course
Npm, package.json & you first project
Npm.js + package.json
Gate to the world: https://www.npmjs.com/
Check the usage stats, issues & code if in doubts
Define your own scripts:
=> see & run “npm run hello” from previous exercise
Defining dependencies:
Dependencies
devDependencies
Do It!
Install, start, develop:
https://github.com/msd-code-
academy/lessons/blob/master/introduction/environment.md#run-hello-
world-application

Contenu connexe

Tendances

Tendances (20)

Automated Development Workflow with Gulp
Automated Development Workflow with GulpAutomated Development Workflow with Gulp
Automated Development Workflow with Gulp
 
Devenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.jsDevenez le plus heureux des Front-end avec Gulp.js
Devenez le plus heureux des Front-end avec Gulp.js
 
Gulp: Task Runner
Gulp: Task RunnerGulp: Task Runner
Gulp: Task Runner
 
Gulp - The Streaming Build System
Gulp - The Streaming Build SystemGulp - The Streaming Build System
Gulp - The Streaming Build System
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
 
Automating your workflow with Gulp.js
Automating your workflow with Gulp.jsAutomating your workflow with Gulp.js
Automating your workflow with Gulp.js
 
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
 
Writing data analysis pipeline as ruby gem
Writing data analysis pipeline as ruby gemWriting data analysis pipeline as ruby gem
Writing data analysis pipeline as ruby gem
 
Introduction to GulpJs
Introduction to GulpJsIntroduction to GulpJs
Introduction to GulpJs
 
Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)
 
Collaboration With Git and GitHub
Collaboration With Git and GitHubCollaboration With Git and GitHub
Collaboration With Git and GitHub
 
Getting started with gulpjs
Getting started with gulpjsGetting started with gulpjs
Getting started with gulpjs
 
Web development tools { starter pack }
Web development tools { starter pack }Web development tools { starter pack }
Web development tools { starter pack }
 
60分鐘完送百萬edm,背後雲端ci/cd實戰大公開
60分鐘完送百萬edm,背後雲端ci/cd實戰大公開60分鐘完送百萬edm,背後雲端ci/cd實戰大公開
60分鐘完送百萬edm,背後雲端ci/cd實戰大公開
 
Screenshot as a service
Screenshot as a serviceScreenshot as a service
Screenshot as a service
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
 
gulp
gulpgulp
gulp
 
Devfest 2021' - Artifact Registry Introduction (Taipei)
Devfest 2021' - Artifact Registry Introduction (Taipei)Devfest 2021' - Artifact Registry Introduction (Taipei)
Devfest 2021' - Artifact Registry Introduction (Taipei)
 
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
TDC2016SP -  Esqueça Grunt ou Gulp. Webpack and NPM rule them all!TDC2016SP -  Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
 

En vedette

NodeJS for Mobile App
NodeJS for Mobile AppNodeJS for Mobile App
NodeJS for Mobile App
Habib MAALEM
 

En vedette (20)

Grunt and Bower
Grunt and BowerGrunt and Bower
Grunt and Bower
 
Code Academy launch presentation
Code Academy launch presentationCode Academy launch presentation
Code Academy launch presentation
 
Customers Before Code – Music Startup Academy, May 12, 2015
Customers Before Code – Music Startup Academy, May 12, 2015Customers Before Code – Music Startup Academy, May 12, 2015
Customers Before Code – Music Startup Academy, May 12, 2015
 
Bower introduction
Bower introductionBower introduction
Bower introduction
 
DevOps - from idea to production
DevOps - from idea to productionDevOps - from idea to production
DevOps - from idea to production
 
NodeJS for Mobile App
NodeJS for Mobile AppNodeJS for Mobile App
NodeJS for Mobile App
 
The Ring programming language version 1.2 book - Part 71 of 84
The Ring programming language version 1.2 book - Part 71 of 84The Ring programming language version 1.2 book - Part 71 of 84
The Ring programming language version 1.2 book - Part 71 of 84
 
Zorgstandaard THL Kinderen & Jongeren
Zorgstandaard THL Kinderen & JongerenZorgstandaard THL Kinderen & Jongeren
Zorgstandaard THL Kinderen & Jongeren
 
Robots leone y juli
Robots leone y juliRobots leone y juli
Robots leone y juli
 
The future [of pixels] is in our hands (first draft)
The future [of pixels] is in our hands (first draft)The future [of pixels] is in our hands (first draft)
The future [of pixels] is in our hands (first draft)
 
Website Mockup
Website MockupWebsite Mockup
Website Mockup
 
Diapositivas
DiapositivasDiapositivas
Diapositivas
 
التشبيه التمثيلي
التشبيه التمثيليالتشبيه التمثيلي
التشبيه التمثيلي
 
черные дыры
черные дырычерные дыры
черные дыры
 
Financing company
Financing companyFinancing company
Financing company
 
W7 57-010126-2009-8
W7 57-010126-2009-8W7 57-010126-2009-8
W7 57-010126-2009-8
 
Epoker
EpokerEpoker
Epoker
 
Node.js
Node.jsNode.js
Node.js
 
Quand utiliser MongoDB … Et quand vous en passer…
Quand utiliser MongoDB	… Et quand vous en passer…Quand utiliser MongoDB	… Et quand vous en passer…
Quand utiliser MongoDB … Et quand vous en passer…
 
JavaScript dans l'usine logicielle
JavaScript dans l'usine logicielleJavaScript dans l'usine logicielle
JavaScript dans l'usine logicielle
 

Similaire à JavaScript code academy - introduction

Topic2JavaBasics.ppt
Topic2JavaBasics.pptTopic2JavaBasics.ppt
Topic2JavaBasics.ppt
MENACE4
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
David Padbury
 
Modeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesModeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based Games
Ray Toal
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
Satya Johnny
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
Ajax Experience 2009
 

Similaire à JavaScript code academy - introduction (20)

JAVA BASICS
JAVA BASICSJAVA BASICS
JAVA BASICS
 
Topic2JavaBasics.ppt
Topic2JavaBasics.pptTopic2JavaBasics.ppt
Topic2JavaBasics.ppt
 
hallleuah_java.ppt
hallleuah_java.ppthallleuah_java.ppt
hallleuah_java.ppt
 
2.ppt
2.ppt2.ppt
2.ppt
 
Add (Syntactic) Sugar To Your Java
Add (Syntactic) Sugar To Your JavaAdd (Syntactic) Sugar To Your Java
Add (Syntactic) Sugar To Your Java
 
Java scriptforjavadev part2a
Java scriptforjavadev part2aJava scriptforjavadev part2a
Java scriptforjavadev part2a
 
JavaBasicsCore1.ppt
JavaBasicsCore1.pptJavaBasicsCore1.ppt
JavaBasicsCore1.ppt
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
 
Modeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based GamesModeling Patterns for JavaScript Browser-Based Games
Modeling Patterns for JavaScript Browser-Based Games
 
Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
 
Adv kvr -satya
Adv  kvr -satyaAdv  kvr -satya
Adv kvr -satya
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript Basics
 
Static analysis: Around Java in 60 minutes
Static analysis: Around Java in 60 minutesStatic analysis: Around Java in 60 minutes
Static analysis: Around Java in 60 minutes
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScript
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
 

Dernier

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

JavaScript code academy - introduction

  • 4. Course content Every week on Wednesday, eight sessions Starting at 6 pm, 20 mins for asking, 6:30 pm presentation & coding Syllabus (might be adjusted to your needs) React.js basics Unit testing Managing application state Dealing with async
  • 5. Today ... Introduction Git, Github, Discussion forum Brief JavaScript history & glossary Setup environment JavaScript basics
  • 6. Git, Github, coding ... All materials & code on Github: https://github.com/msd-code-academy Discussion: http://discourse.js-code-academy.eu/ Common flow: a. Fork the original repository b. Clone it on your machine c. Create feature branch d. Push changes & create pull request
  • 7. Do It! - Install git - Create Github account - Register at discourse.js-code-academy.eu
  • 8. Brief intro to JavaScript history & glossary
  • 9. JavaScript history & glossary Developed in 10 days at Netscape by Brendan Eich Called Mocha -> LiveScript -> JavaScript JavaScript - marketing name (because Java was cool back then) EcmaScript - standard Versioning: 1, 2, 3, 4, 5, 5.1, 6 => 2015, 7 => 2016 Node.js - JavaScript interpreter for server
  • 10. Do it! Setup your environment: https://github.com/msd-code- academy/lessons/blob/master/introduction/environment.md
  • 12. JavaScript basics - functions function returnSomething(param) { Return 'I am hoisted'; } var anonymous = function() { return 'I am anonymous'; }; const fatArrow = () => 'I am lambda & ES6 only!'; new Function('a', 'b', 'return a + b'); // don't do it
  • 13. JavaScript basics - functions & scope var getA = function() { var a = 'AAA'; var hello = 'Hello!'; var getB = function() { var b = 'BBB'; var getC = function() { var c = 'CCC'; var hello = 'Hi!'; console.log(a, b, c); console.log(hello); }; getC(); each function defines new scope code in inner (child) scope can access variables defined in outer (parent) scope variables defined in current scope take precedence over variables in parent scope
  • 14. JavaScript basics - higher order functions Functions are just regular values: They can be passed as an argument to other functions Function can return another function => might help you with abstraction names.map( (name) => name.substr(0, 1).toUpperCase() + name.substr(1) ) const newNames = []; for (var i = 0; i < names.length; i++){ const name = names[i] const newName = name .substr(0,1) .toUpperCase() + name.substr(1); newNames.push(newName); }
  • 15. JavaScript basics - this identifier Refers to the “context” in which the function is called It’s not the reference to scope Any sufficiently advanced technology is indistinguishable from magic. -- Arthur C. Clarke const hasClass = function (className) { return this.classList.contains(className); }; const e = document.querySelector('#elem'); hasClass.call(e); hasClass.call({}); // Cannot read property 'contains' of undefined const imprisoned = hasClass.bind(e); imprisoned();
  • 16. JavaScript basics - this identifier & fat arrow function Fat arrow function binds the context at the creation, that’s it: class Anderson { constructor() { this.name = 'Neo'; this.getName = () => this.name; this.getName2 = function () { return this.name; }; } } const a = new Anderson(); const getName = a.getName; const getName2 = a.getName2; console.log(getName()); console.log(getName2()); // Error: Cannot read property 'name' of undefined, Matrix down
  • 17. Do It! Fork, clone, fix, push: https://github.com/msd-code- academy/lessons/blob/master/introduction/intro_to_js.md#javascript -crash-course
  • 18. Npm, package.json & you first project
  • 19. Npm.js + package.json Gate to the world: https://www.npmjs.com/ Check the usage stats, issues & code if in doubts Define your own scripts: => see & run “npm run hello” from previous exercise Defining dependencies: Dependencies devDependencies
  • 20. Do It! Install, start, develop: https://github.com/msd-code- academy/lessons/blob/master/introduction/environment.md#run-hello- world-application