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
typeofoperator - writing comments
16.03 Introduction to JavaScript
- recap of primitive values
- variables and constants
varletconst
- 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
consts 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()