I started programming for the web 16 years ago.
I studied Computer Engineering at the University of Waterloo.
Since then I've worked on many web projects, big and small.
I've been teaching web development at Bitmaker for the past three years.
I'm really passionate about technology and the web.
You can email me here:
mina@bitmaker.co
INTRO // Goal
- modify a basic task list application
- marks tasks as complete when clicked
- update a count of completed tasks
INTRO
INTRO // Web Development
The development process can be broken into two areas
FRONT-END WEB DEVELOPMENT
BACK-END WEB DEVELOPMENT
How things look to the user
Involves: Images, Content, Structure
HTML, CSS, & Javascript
How things work
Involves: "business logic"
Ruby, PHP, C++, Java, etc.
_________________________________________________________________________________________
INTRO // How The Web Works
A simplified look at a typical web architecture
Client
(Web Browser, Mobile App)
Web Server
Database
Requests
Responses
INTRO // Front-End Technologies
HTML
Content
CSS
Presentation
JavaScript
Interactivity
We'll be learning about JavaScript today
INTRO
INTRO // Tools
We'll be using Google Chrome
It provides many developer-friendly tools ("inspect element")
INTRO // Tools
We'll be using Cloud9
INTRO
The dynamic programming language built into every web browser
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
JavaScript is NOT Java
This is a common misconception
JS
Running Javascript Programs
JS
Any programming language needs to be run by some kind of interpreter that can recognize the code we write and have it do something. With JavaScript, we have a couple of options:
A) Web browsers have this interpreter
B) You can install a standalone interpreter on your computer (i.e. Node.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
Some common data types are:
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
Arrays (One Type of Object)
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
Time to try it yourself!
JS
Writing Basic Javascript Programs
JS
alert(''Hello");
console.log("Hello");
Producing Output:
NOTE - In the first example, the alert will only work if the code is being run from within a browser.
Writing Basic Javascript Programs
JS
var monthName = "June";
if (monthName == "June") {
console.log("It must be summer");
}
Conditional Logic:
Conditional logic involves the use of expressions to evaluate statements that are true or false using operators:
==, <, >, >=, <=, !=
Writing Basic Javascript Programs
JS
var monthName = "July";
if (monthName == "June" || monthName == "July") {
console.log("It must be summer");
}
Conditional Logic:
Expressions can be combined using "OR", which is represented by double pipe characters ||
Writing Basic Javascript Programs
JS
var monthName = "July";
var currentYear = 2016;
if (monthName == "July" && currentYear == 2016) {
console.log("It must be summer of 2016!");
}
Conditional Logic:
Expressions can also be combined using "AND" which is represented by double ampersands &&
Writing Basic Javascript Programs
JS
var monthName = "July";
var currentYear = 2016;
if (monthName == "July" && currentYear == 2016) {
console.log("It must be summer of 2016!");
}
Conditional Logic: