RECAP // Front-End Technologies
HTML
Content
CSS
Presentation
JavaScript
Interactivity
So far, we've focused on mastering HTML & CSS ...
RECAP // Front-End Technologies
HTML is used to describe the content and structure of your document
RECAP // Front-End Technologies
Rules that specify how your elements should appear in your document
RECAP // Front-End Technologies
A programming language that enables us to add interactivity to our pages
RECAP // Front-End Technologies
RECAP // Front-End Technologies
RECAP // Front-End Technologies
RECAP // Front-End Technologies
RECAP // Front-End Technologies
RECAP // Front-End Technologies
The dynamic programming language built into every web browser
JavaScript is really exciting to learn!
JS
It might be challenging at first ...
JS
But that's why we're here to help <3
JS
Don't be afraid of it!
JS
Chances are ... we're all in the same boat 😜
JS
What's JavaScript used for?
JS
Adds interactivity to your web pages
Check out this fun lightbox example!
JS
JavaScript is available in every browser
JS
A little background info on JS ...
JS
Created by Netscape back in 1994
JS
JavaScript is NOT Java
This is a common misconception
JS
View > Developer > JavaScript Console
or
JS
Basic Syntax
var someNumber = 10;JS
Comments
// This is a single line commentJS
How do you store values?
Values are stored in variables
JS
Variables
JS
Declaring a variable
var someNumber = 5;JS
Data Types
JS
There are 6 different types of values:
Let's look at a few data types ...
JS
Number
var someDecimalNumber = 3.1415926;JS
String
var someString = "Some random text here";JS
Boolean
var aTruthyValue = true;
var aFalseyValue = false;JS
undefined
var someUndefinedValue;
var someVariable = undefined;JS
Arrays
var someArray = [45, "bloop", true, null];JS
Arrays cont'd
var someArray = [45, "bloop", true, null];
someArray[1] // returns "bloop"JS
Arrays cont'd
var someArray = [45, "bloop", true, null];
someArray.length // returns 4JS
Objects
var someObject = { key: "value" };
someObject["key"] // returns "value"
someObject.key // returns "value"JS
Time to try it yourself!
JS
http://bettymakes.github.io/fed-intro-to-js-variables/
So many Equal Signs! @_@
= // assignment
== // loose equality
=== // strict equalityJS
Other Operators
> greater than
JS
< less than
>= greater than or equals to
>= less than or equals to
String Concatenation
The + allows you to concatenate one string with another
JS
Be mindful of adding white space!
var fruit = "Apple";
"My favourite fruit is " + fruit;String Concatenation
The + allows you to concatenate one string with another
JS
Be mindful of adding white space!
var fruit = "Apple";
"My favourite fruit is " + fruit;