16.03 Introduction to JavaScript
- the JavaScript programming language
- interpreted languages vs compiled languages
- running JavaScript in the browser
- running JavaScript using
node
- using
console.log()
- JavaScript values
- different types of values
- introduction to variables
let
- variable declaration
- the assignment operator
- changing the value of a variable
- the
typeof
operator - writing comments
16.03 Introduction to JavaScript
- recap of primitive values
- variables and constants
var
let
const
- variable names
- JavaScript expressions
- literals
- arithmetic operators
- variable reassignment
- template literals
- string length
- square bracket notation for strings
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
- JavaScript guidelines and conventions: https://developer.mozilla.org/en-US/docs/MDN/Guidelines/Code_guidelines/JavaScript
- Short tutorial on valid variable names: https://www.dummies.com/article/technology/programming-web-design/javascript/naming-javascript-variables-142522
- Expressions and operators: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
- Operator precedence rules: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
- recap assignment operators:
= += -= *= /= **=
- string accumulation with
+=
- increment operator:
++
- decrement operator:
--
- escaping special characters in strings
- comparison operators:
=== !== < > <= >=
- boolean expressions
- ternary operator:
condition ? expressionIfTrue : expressionIfFalse
- conditional expression
Basic String Methods
-
.toUpperCase()
,.toLowerCase()
-
.substring()
-
.slice()
-
.includes()
-
.trim()
-
parseInt()
-
parseFloat()
-
Rounding up with
Math.ceil()
-
Rounding down with
Math.floor()
-
Getting random numbers with
Math.random()
-
Maximum and minimum with
Math.max()
,Math.min()
-
NaN
,typeof NaN
-
isNaN(<expression>)
-
Very long numbers:
e
, rounding errors -
Rounding errors:
.toFixed()
-
Infinity
Logical Thinking
- Simple preposition analysis
- Logical operators:
- logical AND:
&&
- logical OR:
||
- logical NOT:
!
- logical AND:
- Truthy and falsy values:
false
,undefined
,null
,0
,''
- Short circuit assignment with
||
Array:
- Assigning array literals:
const <array name> = [<value 1>, <value 2>, ...]
- Accessing array items with square brackets
- Re-assigning array items with square brackets
const
s and array items
Basic Array methods
- Finding Items:
Array.prototype.indexOf(<item>)
- Adding items:
Array.prototype.push()
,Array.prototype.unshift()
- Removing items:
Array.prototype.pop()
,Array.prototype.shift()
- Manipulating arrays:
Array.prototype.reverse()
- recap assignment operators:
= += -= *= /= **=
- string accumulation with
+=
- increment operator:
++
- decrement operator:
--
- escaping special characters in strings
- comparison operators:
=== !== < > <= >=
- boolean expressions
- ternary operator:
condition ? expressionIfTrue : expressionIfFalse
- conditional expression
Basic String Methods
.toUpperCase()
,.toLowerCase()
.includes()
.trim()
.substring()
.slice()
parseInt()
parseFloat()
- Rounding numbers with
Math.ceil()
,Math.floor()
,Math.round()
- Maximum and minimum with
Math.max()
,Math.min()
- Rounding errors:
.toFixed()
- https://github.com/FbW-WD21-E11/PB-language-math
- https://github.com/FbW-WD21-E11/PB-language-strings-and-numbers
- Rounding errors:
.toFixed()
Logical Thinking
- Simple preposition analysis
- Logical operators:
- logical AND:
&&
- logical OR:
||
- logical NOT:
!
- logical AND:
- Truthy and falsy values:
false
,undefined
,null
,0
,''
- Short circuit assignment with
||
Array:
-
recap strict equality and (loose) equality
-
Assigning array literals:
const <array name> = [<value 1>, <value 2>, ...]
-
Accessing array items with square brackets
-
Re-assigning array items with square brackets
-
const
s and array items
Basic Array methods
- Finding Items:
Array.prototype.indexOf(<item>)
- Adding items:
Array.prototype.push()
,Array.prototype.unshift()
- Removing items:
Array.prototype.pop()
,Array.prototype.shift()
- Manipulating arrays:
Array.prototype.reverse()
- Array.prototype.concat()
- Array.prototype.slice()
- Array.prototype.splice()
- Array.prototype.join()
- String.prototype.split()
Class with mentor
- introduction to algorithms
- conditional statements
- if...else statement
- if...else if...else
- introduction to scope
- block scope
- switch statement
- loops
- basic for loop
- introduction to functions
- function declaration
- function expression
- arrow function
- parameters and arguments
- function scope
- return statement
- functions with side effects
- array recap
- working with nested arrays
- introduction to memory
- introduction to algorithms
- conditional statements
- if...else statement
- if...else if...else
- introduction to scope
- block scope
- review if...else statement
- introduction to scope
- block scope
- loops
- basic for loop
- while loop
- switch statement
-
introduction to functions
-
declaring a function
-
calling a function
-
functions seen so far
-
function parameters and function arguments
-
return statement
-
Declaring variables in functions
-
function declaration, function expression, arrow function
-
debugger
-
function scope
-
Global vs. Local scope
-
Pure functions vs side effects
-
the call stack
-
Default parameter values
-
rest parameters
-
the args array
- introduction to functions
- declaring a function
- calling a function
- functions seen so far
- function parameters and function arguments
- return statement
- function scope
- function declaration, function expression, arrow function
- Global vs. Local scope
- Pure functions vs side effects
- the call stack
- function declaration: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function
- function expression: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function
- arrow function expression: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
- debugger
- function scope
- Global vs. Local scope
- Pure functions vs side effects
- the call stack
- NaN
- isNaN()
- Number.isNaN()
- Default parameter values
- rest parameters
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters
- review
- test
- object data type
- data type of array
- object literals
- object bracket notation
- object dot notation
- creating methods
- using methods
- for...of
- bracket notation with vars
- Object.keys()
- Object.values()
- Object.entries()
- Object.fromEntries()
- Object.assign()
- copying objects (and arrays)
- copying nested arrays and objects
- spread operator
this
keyword- functions as values
- assigning functions to other variables
- assigning functions to object properties