SlideShare a Scribd company logo
1 of 19
Download to read offline
Introduction to JS
Aleksander Fabijan
Agenda
1. Introduction to AA
2. Background of JS
3. The Basics
a. Statements
b. Variables
c. Data Types (Strings, Objects, Arrays)
d. Functions
About Aleksander
1.
History of JS
The background behind the language of the web.
Brief History of JS
▷ 1995: At Netscape, Brendan Eich created "JavaScript".
▷ 1996: Microsoft releases "JScript", a port for IE3.
▷ 1997: JavaScript was standardized in the "ECMAScript" spec.
▷ 2005: "AJAX" was coined and the web 2.0 age begins.
▷ 2006: jQuery 1.0 was released.
▷ 2010: Node.JS was released.
▷ 2015: ECMAScript 6 was released.
▷ 2016: Microsoft releases HoloJS.
▷ 2017: You started this class.
2.
The Basics
Statements, variables, functions etc.
Tools
Text editor (Atom, Visual Studio Code, etc.)
Chrome Developer Tools
Statements
Each instruction in JS is a "statement", like:
console.log('Hello World!');
Try it out: https://jsbin.com/
Variables
Declare, then
initialize in 2
statements:
var x;
x = 5;
console.log(x);
Or declare and
initialize in one
statement:
var y = 2;
console.log(y);
Re-assign the value
later:
y = 4;
console.log(y);
Primitive Data Types
Strings
A string holds an ordered list of character:
var alphabet = "abcdefghijklmnopqrstuvwxyz";
The length property reports the size of the string:
console.log(alphabet.length); // 26
Each character has an index. The first character is always at index 0.
The last character is always at index length-1:
console.log(alphabet[0]); // 'a'
console.log(alphabet[1]); // 'b'
console.log(alphabet[2]); // 'c'
console.log(alphabet[alphabet.length]); // undefined
console.log(alphabet[alphabet.length-1]); // 'z'
console.log(alphabet[alphabet.length-2]); // 'y'
Objects
var obj = {
name: "Carrot",
"for": "Max",
details: {
color: "orange",
size: 12
}
}
Array
var a = new Array();
a[0] = "dog";
a[1] = "cat";
a.push("parrot");
a.length; // 3
OR
var a = ["dog", "cat", "parrot"];
a.length; // 3
Fun fact
array.length isn't necessarily the number of items in the
array.
Example:
var a = ["dog", "cat", "parrot"];
a[100] = "koala";
a.length; // 101 ---OMG!!!
Fun fact 2
var x = "Volvo" + “16”;
var x = "Volvo" + 16;
var x = "Volvo" + 1+6;
What Happens?
Functions
Functions are re-usable collections of statements.
First declare the function:
function returnMyName() {
console.log('Hi Aleksander!');
}
Then call it (as many times as you want):
returnMyName();
Interactive:
https://repl.it/classroom/invite/CSUTVb0
http://bit.ly/2iKJyBP
3.
Resources
Useful resources
https://jsbin.com (write and execute JS online)
https://jsfiddle.net/ (JS, CSS and HTML playground)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_r
e-introduction_to_JavaScript (a re-intro to JS)
Thanks!
You can find me at:
aleksander.fabijan@mah.se

More Related Content

Viewers also liked

NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1
Tomislav Capan
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
Kevin Ball
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
Shawn Calvert
 

Viewers also liked (16)

Introduction to js (cnt.)
Introduction to js (cnt.)Introduction to js (cnt.)
Introduction to js (cnt.)
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1NodeJs Intro - JavaScript Zagreb Meetup #1
NodeJs Intro - JavaScript Zagreb Meetup #1
 
Intro to javascript (4 week)
Intro to javascript (4 week)Intro to javascript (4 week)
Intro to javascript (4 week)
 
VT17 - DA355A - Introduktion till CSS
VT17 - DA355A - Introduktion till CSSVT17 - DA355A - Introduktion till CSS
VT17 - DA355A - Introduktion till CSS
 
JavaScript Intro
JavaScript IntroJavaScript Intro
JavaScript Intro
 
History of JavaScript
History of JavaScriptHistory of JavaScript
History of JavaScript
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
JavaScript - Intro
JavaScript - IntroJavaScript - Intro
JavaScript - Intro
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
jQuery and Ajax
jQuery and AjaxjQuery and Ajax
jQuery and Ajax
 
Bootstrap 3 Basic - Bangkok WordPress Meetup
Bootstrap 3 Basic - Bangkok WordPress MeetupBootstrap 3 Basic - Bangkok WordPress Meetup
Bootstrap 3 Basic - Bangkok WordPress Meetup
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 

Similar to Javascript intro for MAH

Runtime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya RathoreRuntime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya Rathore
Esha Yadav
 
Os Vanrossum
Os VanrossumOs Vanrossum
Os Vanrossum
oscon2007
 
Java script
 Java script Java script
Java script
bosybosy
 
Java Intro
Java IntroJava Intro
Java Intro
backdoor
 
Ts archiving
Ts   archivingTs   archiving
Ts archiving
Confiz
 

Similar to Javascript intro for MAH (20)

Don't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesDon't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax Trees
 
ES6: Features + Rails
ES6: Features + RailsES6: Features + Rails
ES6: Features + Rails
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Javascript status 2016
Javascript status 2016Javascript status 2016
Javascript status 2016
 
Java script
Java scriptJava script
Java script
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
Modern JS with ES6
Modern JS with ES6Modern JS with ES6
Modern JS with ES6
 
Runtime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya RathoreRuntime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya Rathore
 
Os Vanrossum
Os VanrossumOs Vanrossum
Os Vanrossum
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Handout - Introduction to Programming
Handout - Introduction to ProgrammingHandout - Introduction to Programming
Handout - Introduction to Programming
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
 
jsbasics-slide
jsbasics-slidejsbasics-slide
jsbasics-slide
 
Java script
 Java script Java script
Java script
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Java Intro
Java IntroJava Intro
Java Intro
 
Ts archiving
Ts   archivingTs   archiving
Ts archiving
 
ECMAScript 2015
ECMAScript 2015ECMAScript 2015
ECMAScript 2015
 

More from Aleksander Fabijan (9)

Retrospective 1
Retrospective 1Retrospective 1
Retrospective 1
 
Python oop third class
Python oop   third classPython oop   third class
Python oop third class
 
Python oop - class 2 (inheritance)
Python   oop - class 2 (inheritance)Python   oop - class 2 (inheritance)
Python oop - class 2 (inheritance)
 
Python oop class 1
Python oop   class 1Python oop   class 1
Python oop class 1
 
Introduction to OOP in python inheritance
Introduction to OOP in python   inheritanceIntroduction to OOP in python   inheritance
Introduction to OOP in python inheritance
 
Introduction to OOP in Python
Introduction to OOP in PythonIntroduction to OOP in Python
Introduction to OOP in Python
 
The evolution of continuous experimentation in software product development: ...
The evolution of continuous experimentation in software product development: ...The evolution of continuous experimentation in software product development: ...
The evolution of continuous experimentation in software product development: ...
 
Introduction to data visualisation with D3
Introduction to data visualisation with D3Introduction to data visualisation with D3
Introduction to data visualisation with D3
 
JavaScript development methodology
JavaScript development methodologyJavaScript development methodology
JavaScript development methodology
 

Recently uploaded

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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Javascript intro for MAH

  • 2. Agenda 1. Introduction to AA 2. Background of JS 3. The Basics a. Statements b. Variables c. Data Types (Strings, Objects, Arrays) d. Functions
  • 4. 1. History of JS The background behind the language of the web.
  • 5. Brief History of JS ▷ 1995: At Netscape, Brendan Eich created "JavaScript". ▷ 1996: Microsoft releases "JScript", a port for IE3. ▷ 1997: JavaScript was standardized in the "ECMAScript" spec. ▷ 2005: "AJAX" was coined and the web 2.0 age begins. ▷ 2006: jQuery 1.0 was released. ▷ 2010: Node.JS was released. ▷ 2015: ECMAScript 6 was released. ▷ 2016: Microsoft releases HoloJS. ▷ 2017: You started this class.
  • 7. Tools Text editor (Atom, Visual Studio Code, etc.) Chrome Developer Tools
  • 8. Statements Each instruction in JS is a "statement", like: console.log('Hello World!'); Try it out: https://jsbin.com/
  • 9. Variables Declare, then initialize in 2 statements: var x; x = 5; console.log(x); Or declare and initialize in one statement: var y = 2; console.log(y); Re-assign the value later: y = 4; console.log(y);
  • 11. Strings A string holds an ordered list of character: var alphabet = "abcdefghijklmnopqrstuvwxyz"; The length property reports the size of the string: console.log(alphabet.length); // 26 Each character has an index. The first character is always at index 0. The last character is always at index length-1: console.log(alphabet[0]); // 'a' console.log(alphabet[1]); // 'b' console.log(alphabet[2]); // 'c' console.log(alphabet[alphabet.length]); // undefined console.log(alphabet[alphabet.length-1]); // 'z' console.log(alphabet[alphabet.length-2]); // 'y'
  • 12. Objects var obj = { name: "Carrot", "for": "Max", details: { color: "orange", size: 12 } }
  • 13. Array var a = new Array(); a[0] = "dog"; a[1] = "cat"; a.push("parrot"); a.length; // 3 OR var a = ["dog", "cat", "parrot"]; a.length; // 3
  • 14. Fun fact array.length isn't necessarily the number of items in the array. Example: var a = ["dog", "cat", "parrot"]; a[100] = "koala"; a.length; // 101 ---OMG!!!
  • 15. Fun fact 2 var x = "Volvo" + “16”; var x = "Volvo" + 16; var x = "Volvo" + 1+6; What Happens?
  • 16. Functions Functions are re-usable collections of statements. First declare the function: function returnMyName() { console.log('Hi Aleksander!'); } Then call it (as many times as you want): returnMyName(); Interactive: https://repl.it/classroom/invite/CSUTVb0 http://bit.ly/2iKJyBP
  • 18. Useful resources https://jsbin.com (write and execute JS online) https://jsfiddle.net/ (JS, CSS and HTML playground) https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_r e-introduction_to_JavaScript (a re-intro to JS)
  • 19. Thanks! You can find me at: aleksander.fabijan@mah.se