JavaScript – Objects and Arrays

Objects let us group values to build more complex structures. Objects Objects are a type of value. They’re a random collection of properties. const note = { isPrivate: true, content: “secret” }; The Parts of an Object Braces Property name Colon Property value Comma In JS, braces can be used to start a block of … Read more

JavaScript Refresh – Regular Expressions (RegEx)

Regular expressions are used to find patterns in strings. Tests Like almost everything else in JavaScript, a regular expression is an object. You can create one using the RegExp constructor or by enclosing a pattern in forward sloshes. new RegExp(“hello”); /hello/; The simple regular expression above just looks for an “h” followed by an “e” … Read more

JavaScript Refresh – Errors and Bugs

Languages Bugs are more difficult to find in JS because it’s grammar isn’t very strict. true * “a sentence” There are a couple times when JavaScript won’t know what to do and throw an error. Bad syntax Calling a non-function like a function Trying to look up a property on undefined Strict Mode “use strict” … Read more

JavaScript Refresh – A Deeper Look at Objects

OOP uses objects for program organization. Encapsulation Divide a program into small pieces with each piece managing its own state. When working on one piece, you don’t need to know about the other piece. Pieces of the program interact with each other through interfaces. The interfaces (a limited set of functions) help hide away the … Read more

JavaScript Refresh – Higher Order Functions

Size introduces complexity. Complexity confuses coders. Confused coders create bugs. Functions help you create new vocabulary to solve problems. Abstraction The new vocabulary is equivalent to an abstraction. The complexities are hidden in the function. Higher Order Functions Higher-order functions operate on other functions or take functions as arguments. By passing a function as an … Read more

JavaScript Refresh – Objects and Arrays

Objects and arrays let us group values to build more complex structures. Data Sets Arrays are used to represent a collection of data. It’s a list of values. const numArr = [5, 7, 10]; Arrays use zero-based counting. Properties All JS values (numbers, strings, arrays, etc) have properties except for null and undefined which throw … Read more