SlideShare a Scribd company logo
JavaScript
for Beginners
Bring technical skills
to creative people
Eschults
Edward Schults
Teacher @ Le Wagon
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-3.2.1.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
bit.ly/jsbeginners060417
-30€
(Jusqu'à dimanche, 23h)

More Related Content

PPTX
Meetup Javascript for beginner
PDF
Introduction to jRuby
PPT
01 linux basics
KEY
PDF
Kotlin - Coroutine
PDF
Introduction to kotlin coroutines
PDF
Swift Study #7
PDF
200819 NAVER TECH CONCERT 03_화려한 코루틴이 내 앱을 감싸네! 코루틴으로 작성해보는 깔끔한 비동기 코드
Meetup Javascript for beginner
Introduction to jRuby
01 linux basics
Kotlin - Coroutine
Introduction to kotlin coroutines
Swift Study #7
200819 NAVER TECH CONCERT 03_화려한 코루틴이 내 앱을 감싸네! 코루틴으로 작성해보는 깔끔한 비동기 코드

What's hot (19)

PDF
Crystal Rocks
PPTX
ES6: Features + Rails
PPT
Linux Basics
PDF
Kotlin Coroutines. Flow is coming
KEY
Beauty and Power of Go
PPTX
Python queue solution with asyncio and kafka
PDF
Javascript ES6 generators
PPTX
Using the Power to Prove
ODP
NUMOSS 4th Week - Commandline Tutorial
PPTX
Comets notes
PDF
JavaScript Patterns
PDF
Hacking Mac OSX Cocoa API from Perl
PDF
GoLang & GoatCore
PDF
Vim Hacks (OSSF)
ODP
DPC15 uncon talk: How cyborg puppies can sniff out code smell
PDF
Go初心者がGoでコマンドラインツールの作成に挑戦した話
ODP
Linux Command Line
PPTX
Type script in practice
PDF
ES6 generators
Crystal Rocks
ES6: Features + Rails
Linux Basics
Kotlin Coroutines. Flow is coming
Beauty and Power of Go
Python queue solution with asyncio and kafka
Javascript ES6 generators
Using the Power to Prove
NUMOSS 4th Week - Commandline Tutorial
Comets notes
JavaScript Patterns
Hacking Mac OSX Cocoa API from Perl
GoLang & GoatCore
Vim Hacks (OSSF)
DPC15 uncon talk: How cyborg puppies can sniff out code smell
Go初心者がGoでコマンドラインツールの作成に挑戦した話
Linux Command Line
Type script in practice
ES6 generators
Ad

Viewers also liked (18)

PDF
Techical Workflow for a Startup
PDF
Le Wagon - UI and Design Crash Course
PDF
Le Wagon's Product Design Sprint
PDF
Le Wagon - 2h Landing
PDF
Le Wagon - Bootcamp in Ruby on Rails, HTML, CSS and JavaScript
PDF
Le wagon Aix-Marseille - sketch
PDF
Le wagon UI & design crash course
PDF
Building Layouts with CSS
PDF
Le Wagon - UI components design
PDF
Le Wagon On Demand - Behind the scenes
PDF
Le Wagon Brasil - Launching a Tech Product
PDF
Le Wagon - Technical entrepreneurship
PDF
How Le Wagon uses Trello
PDF
Le Wagon - React 101
PDF
Le Wagon - Web 101
PDF
Le Wagon - Product Specs 101
PDF
API for Beginners
PDF
Git & GitHub for Beginners
Techical Workflow for a Startup
Le Wagon - UI and Design Crash Course
Le Wagon's Product Design Sprint
Le Wagon - 2h Landing
Le Wagon - Bootcamp in Ruby on Rails, HTML, CSS and JavaScript
Le wagon Aix-Marseille - sketch
Le wagon UI & design crash course
Building Layouts with CSS
Le Wagon - UI components design
Le Wagon On Demand - Behind the scenes
Le Wagon Brasil - Launching a Tech Product
Le Wagon - Technical entrepreneurship
How Le Wagon uses Trello
Le Wagon - React 101
Le Wagon - Web 101
Le Wagon - Product Specs 101
API for Beginners
Git & GitHub for Beginners
Ad

Similar to Le wagon - JavaScript for beginners (20)

PDF
Le Wagon - Javascript for Beginners
PDF
Le wagon javascript for beginners - ARF
PDF
Javascript development done right
PPTX
Scala in a Java 8 World
PDF
Introduction kot iin
PDF
JavaScript - Like a Box of Chocolates
PDF
JavaScript Survival Guide
PPTX
Start Writing Groovy
PDF
No excuses, switch to kotlin
PDF
No excuses, switch to kotlin
PDF
Introduction to ECMAScript 2015
PDF
A swift introduction to Swift
PDF
Pooya Khaloo Presentation on IWMC 2015
PPTX
Everyday's JS
PDF
Rediscovering JavaScript: The Language Behind The Libraries
PDF
ECMAScript 6 new features
PDF
Bologna Developer Zone - About Kotlin
KEY
JavaScript @ CTK
PPTX
Swift - Modern & Expressive, or Magical Unicorn?
PDF
The Future of JVM Languages
Le Wagon - Javascript for Beginners
Le wagon javascript for beginners - ARF
Javascript development done right
Scala in a Java 8 World
Introduction kot iin
JavaScript - Like a Box of Chocolates
JavaScript Survival Guide
Start Writing Groovy
No excuses, switch to kotlin
No excuses, switch to kotlin
Introduction to ECMAScript 2015
A swift introduction to Swift
Pooya Khaloo Presentation on IWMC 2015
Everyday's JS
Rediscovering JavaScript: The Language Behind The Libraries
ECMAScript 6 new features
Bologna Developer Zone - About Kotlin
JavaScript @ CTK
Swift - Modern & Expressive, or Magical Unicorn?
The Future of JVM Languages

Recently uploaded (20)

PDF
RMMM.pdf make it easy to upload and study
PPTX
Cell Types and Its function , kingdom of life
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
master seminar digital applications in india
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Institutional Correction lecture only . . .
PDF
Complications of Minimal Access Surgery at WLH
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Pre independence Education in Inndia.pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Cell Structure & Organelles in detailed.
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
RMMM.pdf make it easy to upload and study
Cell Types and Its function , kingdom of life
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
master seminar digital applications in india
STATICS OF THE RIGID BODIES Hibbelers.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Institutional Correction lecture only . . .
Complications of Minimal Access Surgery at WLH
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
TR - Agricultural Crops Production NC III.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pre independence Education in Inndia.pdf
Week 4 Term 3 Study Techniques revisited.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Cell Structure & Organelles in detailed.
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES

Le wagon - JavaScript for beginners