SlideShare a Scribd company logo
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

PPTX
Secure code 3rd_party_libs
PDF
My Sq Ldb Tut
PPTX
Comets notes
PDF
Mastering the Unix Command Line
PDF
Terminalcommandsubuntu1 170123133631 (1)
PPT
Craig Brown speaks on ElasticSearch
DOC
How to send files to remote server via ssh in php
PDF
Learn to Write ur first Shell script
Secure code 3rd_party_libs
My Sq Ldb Tut
Comets notes
Mastering the Unix Command Line
Terminalcommandsubuntu1 170123133631 (1)
Craig Brown speaks on ElasticSearch
How to send files to remote server via ssh in php
Learn to Write ur first Shell script

Viewers also liked (16)

PDF
Introduction to js (cnt.)
PDF
Intro to JavaScript
PPTX
Intro to Javascript
PDF
NodeJs Intro - JavaScript Zagreb Meetup #1
PDF
Intro to javascript (4 week)
PDF
VT17 - DA355A - Introduktion till CSS
PDF
JavaScript Intro
ODP
History of JavaScript
KEY
Intro to Javascript
PPTX
JavaScript - Intro
PDF
Intro to Javascript and jQuery
PDF
Intro to JavaScript
PDF
Intro to JavaScript
PDF
jQuery and Ajax
PDF
Bootstrap 3 Basic - Bangkok WordPress Meetup
PDF
ES6: The Awesome Parts
Introduction to js (cnt.)
Intro to JavaScript
Intro to Javascript
NodeJs Intro - JavaScript Zagreb Meetup #1
Intro to javascript (4 week)
VT17 - DA355A - Introduktion till CSS
JavaScript Intro
History of JavaScript
Intro to Javascript
JavaScript - Intro
Intro to Javascript and jQuery
Intro to JavaScript
Intro to JavaScript
jQuery and Ajax
Bootstrap 3 Basic - Bangkok WordPress Meetup
ES6: The Awesome Parts
Ad

Similar to Javascript intro for MAH (20)

PPTX
Don't Be Afraid of Abstract Syntax Trees
PPTX
ES6: Features + Rails
PDF
React Native Evening
PDF
Game Design and Development Workshop Day 1
PPT
JavaScript - An Introduction
PDF
Javascript status 2016
PPTX
Java script
PDF
Node Boot Camp
PPTX
Modern JS with ES6
PPT
Runtime Environment Of .Net Divya Rathore
PPT
Os Vanrossum
PPTX
TypeScript
PDF
Handout - Introduction to Programming
PPT
Ajax and JavaScript Bootcamp
ODP
jsbasics-slide
PPTX
Java script
PPT
JavaScript Basics
PPT
Java Intro
PDF
Ts archiving
PPTX
ECMAScript 2015
Don't Be Afraid of Abstract Syntax Trees
ES6: Features + Rails
React Native Evening
Game Design and Development Workshop Day 1
JavaScript - An Introduction
Javascript status 2016
Java script
Node Boot Camp
Modern JS with ES6
Runtime Environment Of .Net Divya Rathore
Os Vanrossum
TypeScript
Handout - Introduction to Programming
Ajax and JavaScript Bootcamp
jsbasics-slide
Java script
JavaScript Basics
Java Intro
Ts archiving
ECMAScript 2015
Ad

More from Aleksander Fabijan (9)

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

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Empathic Computing: Creating Shared Understanding
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
KodekX | Application Modernization Development
PPTX
MYSQL Presentation for SQL database connectivity
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Modernizing your data center with Dell and AMD
Review of recent advances in non-invasive hemoglobin estimation
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Chapter 3 Spatial Domain Image Processing.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Spectral efficient network and resource selection model in 5G networks
NewMind AI Monthly Chronicles - July 2025
Digital-Transformation-Roadmap-for-Companies.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The Rise and Fall of 3GPP – Time for a Sabbatical?

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