Javascript

What You Need to Know

What is Javascript

  • Scripting Language
  • Dynamically Typed
  • The language of the internet
  • Used mainly for behaviour control
  • JQuery, React, Angular, Vue, Backbone

Variable Types and Declarations

Open Browsers and head to playcode.io

Primitives

  • Numbers: float, double, integer
  • Characters: strings, character

Variable Types and Declarations

Q/A

  • What is the keyword for declaring new variables?
  • What is the assignment operator?
  • What can variable names start with?

Operators

  • Assignment
  • Arithmetic
  • Comparison
  • Logical

Arithmetic Operators

  • +, -, /, *

Comparison Operators

  • ==, <=, >=, <, >

Logical Operators

  • &&, ||, !

Q/A

  • What are the two values comparison and logical operators evaluate too?
  • Under what conditions do AND statements return true?
  • Under what conditions do OR statements return true?
  • Under what conditions do NOT statements return true?

Control Structures Part 1 - Logical Control

  • If
  • If/Else
  • Switch

If

If Else

Switch

Q/A

  • What are the three types of logical control structures?
  • What happens if you forget a break statement?

Functions

Functions are a way to create reusable code.

Q/A

  • What programming practice coincides with creating functions?
  • What is the keyword for declaring functions?
  • What is the keyword for passing values back from functions?

Data Structures

  • Objects and Classes
  • Arrays
  • Dictionaries

Objects, Classes, and The Dot Operator

Classes are Blueprints for Objects

Objects, Classes, and The Dot Operator

Objects, Classes, and The Dot Operator

Objects are Instances of Classes

Arrays

Indexed by number starting at 0

Indexes 0 1 2 3 4

Dictionaries

Indexed by key

key

value

Control Structures Part 2 - Iterators

Iterators are used to move through collections of data.

  • while loop
  • for loop
  • for/in loop
  • for/of loop

While Loop

For Loop

For/In Loop

For/In Loop

For/Of Loop

Q/A

  • Which two loops use a counter variable variable?
  • What does the For/In loop iterate over?
  • What does the For/Of loop return on each iteration?
Javascript - Google Slides