DOM Manipulation And Events
DOM - Document Object Model The DOM (or Document Object Model) is a tree-like representation of the contents of a webpage - a tree of “nodes” with different relationships depending on how they’re arranged in the HTML document.
<div id="container"> <div class="display"></div> <div class="controls"></div> </div> In the above example, the <div class="display"></div> is a “child” of <div id="container"></div> and a sibling to <div class="control"></div>. Think of it like a family tree.
JavaScript Fundamentals V
Objects Objects are used to store keyed collections of various data and more complex entities.
An object can be created with figure brackets {…} with an optional list of properties. A property is a “key: value” pair, where key is a string (also called a “property name”), and value can be anything.
Imagine an object as a cabinet with signed files. Every piece of data is stored in its file by the key.
JavaScript Fundamentals IV
Arrays An Array is an ordered collection of items (Strings, numbers, or other things), array items are indexed from 0 to -1, -1 being the last item of your array, and 0 being the first, that makes the items inside easily accessible.
const cars = ["BMW", "Honda", "Toyota"]; cars[0]; // prints "BMW" cars[1]; // prints "Honda" cars[2]; // prints "Toyota" cars[-1]; // also prints "Toyota" cars[-2]; // would print the second to last item, in this case "Honda" // and so on.
JavaScript Fundamentals III
Lesson Overview Define and invoke different kinds of functions. Use the return value. Explain function scope. Functions Functions are the main “building block” of our programs. They allow us to call code many times without repetition. That way we don’t have to write the same code over and over, it’s like storing a piece of code, that does a task inside a defined block.
function showMessage() { alert( 'Hello everyone!' ); } Everytime you make use of a JavaScript structure that features a pair of parentheses () and you’re not using a common built-in language structure like a for loop, while or do…while loop, or if…else statement, you are making use of a function.
JavaScript Fundamentals II
Lesson Overview Name the eight data types in JavaScript. number, for numbers of any kind integer or floating-point, integers are limited by ±(253-1). bigint, for integer numbers of arbitrary length. string, for strings. boolean, for true/false. null, for unkown values undefined, for unassigned values. symbol, for unique identifiers. object, for more complex data structures. Understand the difference between single, double and backtick quotes. Not much difference between single and double quote, except when your string contains one of em, then you need to use the other