SlideShare a Scribd company logo
1 of 43
TTS JavaScript Workshop
5/26/2015
@assafweinberg | assaf@levvel.io
Agenda
• What is JavaScript?
• 6 Language Fundamentals
• Workshop part 1
• JavaScript in the Browser
• Workshop part 2
http://javascript.crockford.com/javascript.html
What is JavaScript?
Language Fundamentals
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
Variables
JavaScript is…
Loosely Typed
Loosely Typed
Loose Typing
Type Coercion
Coercion
Coercion
Arrays
Objects
In JavaScript…
Objects are mutable
Objects are mutable
What does it all mean?
Is JavaScript Object Oriented?
JavaScript is…
Not Object Oriented,
it’s Functional
Not Object Oriented,
it’s Functional
Functions
In JavaScript…
Functions are
Objects
Functions are
Objects
Functions as Properties
Functions as Parameters
What’s this?
In JavaScript…
“this” refers to the
caller of the function
“this” refers to the
caller of the function
Variable Scope
In JavaScript…
Functions have scope,
blocks do not
Functions have scope,
blocks do not
Scope
Closures
Closures
will always have access to variables that were in scope when it w
JavaScript…
Uses Closures
(functions have access to variables that were
in scope when they were created)
(functions have access to variables that were
in scope when they were created)
(functions have access to variables that were
in scope when they were created)
6 Lessons in
JavaScript…
Loosely typed
Mutable objects
Functional language
Functions are Objects
Uses the “this” keyword to refer to callers
Uses closures
Uses closures
Uses closures
Uses closures
WTF Miyagi?
It’s Code Time
Tournament Rules
1. Create an object to model a karate move. A move has a name (e.g. ‘karate chop’, ‘crane
kick”, etc.), and a strength score between 1 and 10. Output the move’s name to the console.
2. Create an array with at least 5 karate move objects. Output the name of the 3rd item in the
array to the console.
3. Create two objects to model karate fighters. Each fighter has a name, an array of moves,
and a function called “performMove” that returns a random move.
4. Create a function called “fight” that takes 2 fighter objects, gets a move from each of them,
and outputs a string “[fighter name] did [move name], [fighter 2 name] countered with [move
name 2].” to the console. Then return the winning fighter object with the higher strength
move. Null if tied.
5. Create a function that takes two fighters and makes them fight until one fighter has won 3
rounds, then outputs “[fightername] wins!” to the console
https://jsfiddle.net/
JavaScript in the Browser
Runs before page loads
Runs after page loads
DOM Manipulation
1. Find something
2. Listen for it to fire an event
3. Edit the DOM based on event
window Object
http://www.w3schools.com/jsref/obj_window.asp
Document Object
Model
http://www.w3schools.com/jsref/obj_window.asp
Editing HTML with JavaScript
Find Something
Attach Event Handler
Another Example
Browser Exercise
1.Create an HTML page and a script that outputs “hello world” to the
console. Import the script onto the page.
2.Create a button and a paragraph. When the button is clicked, the
paragraph should say “button clicked”.
3.Change the button click action to display the # of times the button
has been clicked in the paragraph.
4.Create an input box and a list on the page. Every time the button is
clicked, add a an item to the list with the text from the text input.
* Bonus Problem - Add a delete button to each list item and remove
the item when the corresponding button is clicked.
Thank You
@assafweinberg | assaf@levvel.io

More Related Content

What's hot

Intro to javascript (6:27)
Intro to javascript (6:27)Intro to javascript (6:27)
Intro to javascript (6:27)David Coulter
 
Actor model : A Different Concurrency Approach
Actor model : A Different Concurrency ApproachActor model : A Different Concurrency Approach
Actor model : A Different Concurrency ApproachEmre Akış
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threadsmperham
 
Asynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & PromisesAsynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & PromisesHùng Nguyễn Huy
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application TestingTroy Miles
 
Functional programing jargon
Functional programing jargonFunctional programing jargon
Functional programing jargonRemo Jansen
 
REACT.JS : Rethinking UI Development Using JavaScript
REACT.JS : Rethinking UI Development Using JavaScriptREACT.JS : Rethinking UI Development Using JavaScript
REACT.JS : Rethinking UI Development Using JavaScriptDeepu S Nath
 
Sane Sharding with Akka Cluster
Sane Sharding with Akka ClusterSane Sharding with Akka Cluster
Sane Sharding with Akka Clustermiciek
 
Constructor overloading in C++
Constructor overloading in C++Constructor overloading in C++
Constructor overloading in C++Learn By Watch
 
Oslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep DiveOslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep Divedavanum
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and AkkaYung-Lin Ho
 
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
 
Object Oriented Prograring(OOP) java
Object Oriented Prograring(OOP) javaObject Oriented Prograring(OOP) java
Object Oriented Prograring(OOP) javaGaddafiAdamu1
 

What's hot (20)

Intro to javascript (6:27)
Intro to javascript (6:27)Intro to javascript (6:27)
Intro to javascript (6:27)
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
JavaScript Good Practices
JavaScript Good PracticesJavaScript Good Practices
JavaScript Good Practices
 
Lecture 2: ES6 / ES2015 Slide
Lecture 2: ES6 / ES2015 SlideLecture 2: ES6 / ES2015 Slide
Lecture 2: ES6 / ES2015 Slide
 
Actor model : A Different Concurrency Approach
Actor model : A Different Concurrency ApproachActor model : A Different Concurrency Approach
Actor model : A Different Concurrency Approach
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
Upgrading to rails3
Upgrading to rails3Upgrading to rails3
Upgrading to rails3
 
Javascript
JavascriptJavascript
Javascript
 
Asynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & PromisesAsynchronous JavaScript Programming with Callbacks & Promises
Asynchronous JavaScript Programming with Callbacks & Promises
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
 
Functional programing jargon
Functional programing jargonFunctional programing jargon
Functional programing jargon
 
Async Web QA
Async Web QAAsync Web QA
Async Web QA
 
REACT.JS : Rethinking UI Development Using JavaScript
REACT.JS : Rethinking UI Development Using JavaScriptREACT.JS : Rethinking UI Development Using JavaScript
REACT.JS : Rethinking UI Development Using JavaScript
 
Sane Sharding with Akka Cluster
Sane Sharding with Akka ClusterSane Sharding with Akka Cluster
Sane Sharding with Akka Cluster
 
Constructor overloading in C++
Constructor overloading in C++Constructor overloading in C++
Constructor overloading in C++
 
Oslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep DiveOslo.versioned objects - Deep Dive
Oslo.versioned objects - Deep Dive
 
Introduction to Actor Model and Akka
Introduction to Actor Model and AkkaIntroduction to Actor Model and Akka
Introduction to Actor Model and Akka
 
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
 
Object Oriented Prograring(OOP) java
Object Oriented Prograring(OOP) javaObject Oriented Prograring(OOP) java
Object Oriented Prograring(OOP) java
 
Callback Function
Callback FunctionCallback Function
Callback Function
 

Viewers also liked (6)

Grand Tirolia Golf & Ski Resort Kitzbühel
Grand Tirolia Golf & Ski Resort KitzbühelGrand Tirolia Golf & Ski Resort Kitzbühel
Grand Tirolia Golf & Ski Resort Kitzbühel
 
SXSW 2010
SXSW 2010SXSW 2010
SXSW 2010
 
Ashe
AsheAshe
Ashe
 
Biznes Od A Do Z
Biznes Od A Do ZBiznes Od A Do Z
Biznes Od A Do Z
 
Natural wonders
Natural wonders Natural wonders
Natural wonders
 
Grand Tirolia Golf & Ski Resort Kitzbuhel
Grand Tirolia Golf & Ski Resort KitzbuhelGrand Tirolia Golf & Ski Resort Kitzbuhel
Grand Tirolia Golf & Ski Resort Kitzbuhel
 

Similar to Javascript Workshop

Similar to Javascript Workshop (20)

JavaScript
JavaScriptJavaScript
JavaScript
 
[2015/2016] JavaScript
[2015/2016] JavaScript[2015/2016] JavaScript
[2015/2016] JavaScript
 
JS basics
JS basicsJS basics
JS basics
 
Understanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG JuneUnderstanding Object Oriented Javascript - Coffee@DBG June
Understanding Object Oriented Javascript - Coffee@DBG June
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
Scripting as a Second Language
Scripting as a Second LanguageScripting as a Second Language
Scripting as a Second Language
 
Event Programming JavaScript
Event Programming JavaScriptEvent Programming JavaScript
Event Programming JavaScript
 
JavaScript for real men
JavaScript for real menJavaScript for real men
JavaScript for real men
 
Javascript classes and scoping
Javascript classes and scopingJavascript classes and scoping
Javascript classes and scoping
 
JS Essence
JS EssenceJS Essence
JS Essence
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 
Modern JavaScript Development @ DotNetToscana
Modern JavaScript Development @ DotNetToscanaModern JavaScript Development @ DotNetToscana
Modern JavaScript Development @ DotNetToscana
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Ajaxworld
AjaxworldAjaxworld
Ajaxworld
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
Object oriented java script
Object oriented java scriptObject oriented java script
Object oriented java script
 
A tour on ruby and friends
A tour on ruby and friendsA tour on ruby and friends
A tour on ruby and friends
 

Recently uploaded

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
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
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 

Recently uploaded (20)

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
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
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 

Javascript Workshop

Editor's Notes

  1. In 1995, Netscape wanted to add scriptability to the web. 1) Easy for beginners - given web pages weren't being developed by programmers 2) Look like java - to capitalize on the language’s popularity at the time - Brandon Eich modeled JavaScript after SCHEME in 10 days
  2. JavaScript is NOT JAVA. Different classification of language (Object Oriented vs functional)
  3. The key to not being frustrated with JS is to understand what it is before diving in.
  4. Variables created with keyword ‘var’ JavaScript uses loose typing (e.g. var can be string or number) Goal was ease of use
  5. Lesson 1
  6. Runtime engine automatically converts vars to the type that makes the most sense Leads to unexpected behavior
  7. Double equals attempts to coerce the two values before checking equality
  8. “Falsey” values like 0, null, and undefined get evaluated to false, while everything else including strings and objects are “true”.
  9. Arrays work like they do in most other languages
  10. Objects are just hashes/maps/dictionaries Objects are mutable. Properties can be added or removed.
  11. Mutable objects have huge consequences for how the language is used.
  12. IN OO languages, parameters are of known type and their properties are known
  13. In JS, mutable objects mean that object type is of limited value Is the object being passed into the teach function a student or an oak tree?
  14. Many people argue JS is OO because it has objects and can support encapsulation. But without strong typing, most of the benefits of building systems in an Object Oriented way are lost, so most programmers don’t create true OO systems in JS.
  15. Functions can be assigned as object properties, just like any other object
  16. Functions can be passed in to other functions as parameters… just like any other object
  17. The “this” keyword refers to the caller of the function. Imagine a function as a physical piece of paper with instructions. Some of those instructions might refer to the reader (e.g. “say your name”). The “this” keyword refers to the reader.
  18. Variables go out of scope at the end of a function, not a block like an if statement or for loop.
  19. In OO languages the only variables available inside a function are the ones passed in as parameters. In JS, all variables in scope when a function is declared are addressable inside the function.
  20. Ok, enough theory (sanding floors and getting beat downs by the Cobra Kai)
  21. Go to jsFiddle.net and complete this 5 step exercise.
  22. Language fundamentals are great, but you’re probably learning JS so you can use it in the browser.
  23. Add JS to your HTML page in the head or before body tag close, but preferably the latter for performance reasons. There are other nuances for inclusion, but this is the basics.
  24. The typical pattern for adding simple browser interactivity is finding an element, adding an event handler to it, and editing the DOM when the event fires.
  25. Browser injects a global window object that refers to the browser window. Most important property is window.document, that refers to the HTML document loaded in the browser.
  26. The DOM is a hierarchical object representing the HTML loaded in the browser. It is query able and editable by JS. The API confuses a lot of people, so go to your happy place if you need to.
  27. Step 1: find an element in the DOM
  28. Step 2: set a function to run when an event happens to that element.
  29. Step 3: edit the dom when the event fires. In thise case, a click.
  30. Is just a helper library to help you do those three steps in a simpler syntax. Use it if you need to but be careful not to go too far before reaching for a full JS framework like backbone, angular, react, etc.