JavaScript
for Beginners
@ssaunier
{ , }/ssaunier
Sébastien Saunier
CTO @ Le Wagon
Bring technical skills
to creative people
Let's talk about JavaScript
In-browser language
(since 1995)
Le Wagon - Javascript for Beginners
Sublime Text
JS Bin
Data types
typeof
Numbers
-100
0
1
3.14
42
Boolean
true
false
String
"John"
"John Lennon"
"a"
""
Object
{
"first_name" : "John",
"last_name" : "Lennon"
}
[ "john", "paul", "ringo", "george" ]
null
undefined
Variables
var
var firstName;
var firstName = "John";
"John"
console.log(firstName);
"John"
Concatenate two strings
Exercise
Conditions
if, else
if (weather === "rainy") {
console.log("Take an umbrella");
}
if (weather === "rainy") {
console.log("Take an umbrella");
} else {
console.log("Take your sunglasses");
}
if (weather === "rainy") {
console.log("Take an umbrella");
} else if (weather === "stormy") {
console.log("Stay at home");
} else {
console.log("Take your sunglasses");
}
Boolean algebra
&&, ||, !
var result = a && b;
Logical and
a b result
false false false
false true false
true false false
true true true
var rain = true;
var wind = true;
if (rain && wind) {
console.log("Really stay at home");
}
var result = a || b;
Logical or
a b result
false false false
false true true
true false true
true true true
var day = "Saturday";
if (day === "Saturday" || day === "Sunday") {
console.log("It's the week-end!");
}
var result = !a;
Logical not
a result
true false
false true
var sunny = true;
if (!sunny) {
console.log("Cancel the beach");
}
var weather = "raining";
if (weather !== "sunny") {
console.log("Cancel the beach");
}
Filter names starting with a "B"
Exercise
Loops
for, while
Array
var students = [ "john", "paul", "ringo" ];
students.length // => 3
students[0] // => "john"
students[2] // => "ringo"
students[1] // => "paul"
For
for (var i = 0; i < students.length; i += 1) {
console.log(students[i]);
}
Filter names starting with a "B"
Exercise bis
While
var i = 0;
while (i < students.length) {
console.log(students[i]);

i += 1;
}
Functions
function
function name(parameters) {
body
(return statement)
}
function fullName(first, last) {
var name = first + " " + last;
return name;
}
Example: Full Name
fullName("John", "Lennon");
Calling a function
Function name arguments
Filter names starting with "B"
starting with "C"
…
Exercise ter
DOM
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>
Hello
</h1>
<p>
Lorem Ipsum…
</p>
</body>
</html>
html
<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>
Hello
</h1>
<p>
Lorem Ipsum…
</p>
</body>
</html>
html
head body
<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>
Hello
</h1>
<p>
Lorem Ipsum…
</p>
</body>
</html>
html
head body
title
<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>
Hello
</h1>
<p>
Lorem Ipsum…
</p>
</body>
</html>
html
head body
title h1 p
jQuery
Le Wagon - Javascript for Beginners
https://code.jquery.com/jquery-1.11.3.min.js
$(document).ready(function() {
// The jQuery-dependent code
});
1 - DOM Manipulation
p
$("p").hide();
<h1>
Hello
</h1>
<p>
Lorem Ipsum…
</p>
<p>
Autrum Ipsum…
</p>
Element Selector
#cart
$("#cart").hide();
<h1>
Hello
</h1>
<div id="cart">
[…]
</div>
<div>
[…]
</div>
Id selector
.red
$(".red").hide();
<div class="green">
Hello
</h1>
<div class="red">
[…]
</div>
<div class="red">
[…]
</div>
Class selector
<div id="cart" class="red">
[…]
</div>
$("#cart").addClass(‘bold’);
<div id="cart" class="red">
[…]
</div>
$("#cart").addClass(‘bold’);
<div id="cart" class="red">
[…]
</div>
<div id="cart" class="bold red">
[…]
</div>
$("#cart").removeClass(‘bold’);
<div id="cart" class="bold red">
[…]
</div>
<div id="cart" class="red">
[…]
</div>
2 - Event Handling
$('#play-button').click();
$('#an-element').on('click', function() {
alert("You have clicked");
});
3 - AJAX
(To be continued…)
Resources
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
ondemand.lewagon.org/jsmeetup
-30€
(Jusqu'à dimanche, 23h)

More Related Content

PDF
Le Wagon - React 101
PDF
Git & GitHub WorkShop
PDF
Le Wagon - 2h Landing
PDF
Le Wagon - UI components design
PDF
Le Wagon - Web 101
PDF
API for Beginners
PDF
Techical Workflow for a Startup
PDF
Git & GitHub for Beginners
Le Wagon - React 101
Git & GitHub WorkShop
Le Wagon - 2h Landing
Le Wagon - UI components design
Le Wagon - Web 101
API for Beginners
Techical Workflow for a Startup
Git & GitHub for Beginners

What's hot (20)

PDF
Le Wagon - UI and Design Crash Course
PPT
JavaScript
PPTX
Css Display Property
PDF
React
PDF
기본적인 테스트에 대한 pytest 자동화 접근
PDF
Tema 6 - Formularios en html
PDF
CSS selectors
PPT
CSS
PDF
JSON-LD: JSON for the Social Web
PDF
Spring Batch
PDF
Introduction to CSS3
PPTX
Java script array
PDF
Introduction to Redux
PPT
Javascript
PPT
JUnit 4
PPTX
Javascript 101
PDF
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
PDF
Angular directives and pipes
PPTX
Angular Data Binding
PPTX
React Architecture & Best Practices.pptx
Le Wagon - UI and Design Crash Course
JavaScript
Css Display Property
React
기본적인 테스트에 대한 pytest 자동화 접근
Tema 6 - Formularios en html
CSS selectors
CSS
JSON-LD: JSON for the Social Web
Spring Batch
Introduction to CSS3
Java script array
Introduction to Redux
Javascript
JUnit 4
Javascript 101
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
Angular directives and pipes
Angular Data Binding
React Architecture & Best Practices.pptx
Ad

Similar to Le Wagon - Javascript for Beginners (20)

PDF
Le wagon - JavaScript for beginners
PPTX
Meetup Javascript for beginner
PDF
Javascript 101 - Javascript para Iniciantes
PDF
Le wagon javascript for beginners - ARF
PDF
An Introduction to JavaScript: Week One
PPSX
Javascript variables and datatypes
PDF
JavaScript From Scratch: Playing With Data
PDF
Le Wagon Australia Workshop
PDF
Fundamental JavaScript [UTC, March 2014]
PPTX
Introduction to Client-Side Javascript
PPTX
JavaScript Operators
PPTX
Introduction to JavaScript
PDF
JavaScript from Scratch: Getting Your Feet Wet
PDF
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
PPSX
DIWE - Programming with JavaScript
PDF
JavaScript for beginners
PDF
Fewd week5 slides
PDF
Lecture 03 - JQuery.pdf
PDF
Java script introducation & basics
 
PDF
Handout - Introduction to Programming
Le wagon - JavaScript for beginners
Meetup Javascript for beginner
Javascript 101 - Javascript para Iniciantes
Le wagon javascript for beginners - ARF
An Introduction to JavaScript: Week One
Javascript variables and datatypes
JavaScript From Scratch: Playing With Data
Le Wagon Australia Workshop
Fundamental JavaScript [UTC, March 2014]
Introduction to Client-Side Javascript
JavaScript Operators
Introduction to JavaScript
JavaScript from Scratch: Getting Your Feet Wet
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
DIWE - Programming with JavaScript
JavaScript for beginners
Fewd week5 slides
Lecture 03 - JQuery.pdf
Java script introducation & basics
 
Handout - Introduction to Programming
Ad

Recently uploaded (20)

PPTX
ACFE CERTIFICATION TRAINING ON LAW.pptx
PPTX
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
PDF
Disorder of Endocrine system (1).pdfyyhyyyy
PDF
Compact First Student's Book Cambridge Official
PDF
FYJC - Chemistry textbook - standard 11.
PPT
Acidosis in Dairy Herds: Causes, Signs, Management, Prevention and Treatment
PDF
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
PPTX
Designing Adaptive Learning Paths in Virtual Learning Environments
PPTX
Diploma pharmaceutics notes..helps diploma students
PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PDF
Solved Past paper of Pediatric Health Nursing PHN BS Nursing 5th Semester
PPT
hemostasis and its significance, physiology
PPTX
Neurological complocations of systemic disease
PPTX
2025 High Blood Pressure Guideline Slide Set.pptx
PDF
Physical education and sports and CWSN notes
PDF
Laparoscopic Dissection Techniques at WLH
PPTX
UNIT_2-__LIPIDS[1].pptx.................
PDF
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
PDF
Nurlina - Urban Planner Portfolio (english ver)
PPTX
PLASMA AND ITS CONSTITUENTS 123.pptx
ACFE CERTIFICATION TRAINING ON LAW.pptx
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
Disorder of Endocrine system (1).pdfyyhyyyy
Compact First Student's Book Cambridge Official
FYJC - Chemistry textbook - standard 11.
Acidosis in Dairy Herds: Causes, Signs, Management, Prevention and Treatment
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
Designing Adaptive Learning Paths in Virtual Learning Environments
Diploma pharmaceutics notes..helps diploma students
Everyday Spelling and Grammar by Kathi Wyldeck
Solved Past paper of Pediatric Health Nursing PHN BS Nursing 5th Semester
hemostasis and its significance, physiology
Neurological complocations of systemic disease
2025 High Blood Pressure Guideline Slide Set.pptx
Physical education and sports and CWSN notes
Laparoscopic Dissection Techniques at WLH
UNIT_2-__LIPIDS[1].pptx.................
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
Nurlina - Urban Planner Portfolio (english ver)
PLASMA AND ITS CONSTITUENTS 123.pptx

Le Wagon - Javascript for Beginners