JavaScript Refresh – Functions

Functions help us structure larger programs, reduce repetition, self-document pieces of a program using names, and isolate the code from other parts. A new function is like adding a new word to a language. Defining a function The function is the value of the variable. const double = function (x) { return x * 2; … Read more

JavaScript Refresh – Program Structure

Expressions and statements A fragment of code that produces a value is called an expression. Expressions can contain other expressions. true l false 1 “hello” 2×5 Math.min((2+6),4) Statements Statements are one or multiple expressions with a semicolon after it. A program is a list of statements. Statements are made up of expressions. This is a … Read more

JavaScript Refresh – Values, Types, and Operators

Values 18 “hello” true Numbers .18 1.8 18 18000000000000000000 Infinity -Infinity Strings “hello” ‘hello’ `hello` “hello” + “hello” = “hellohello” template literals: `half of 100 is ${100 / 2}` Operators (Unary, Binary, Ternary) 2 * 3 3 / 2 10 % 4 3 + 4 3 – 4 -4 typeof “something” ! 3 < 4 3 … Read more

Intermediate JavaScript 2 – Objects and Loops

Objects JavaScript objects are collections of keys and values. The keys are strings, and the values can be anything (strings, integers, functions, arrays, or another object). let emptyObject = {} let myCollection = { foods: [‘spaghetti’, ‘Chili’], “getFirst”: function getFirst (items) { return items[0]; }, } let myCollection = {…} Creating an object in JavaScript … Read more

Beginner JavaScript Part 1

JavaScript is a programming language that runs in your browser. It is the only client-side (runs in your browser) programming language. Its original purpose was to add a little interactivity to static web pages, but now days, it is a full-fledged programming language. A static web page is pretty boring. Besides looking at the content, … Read more