reading-notes

Aloysious' Codefellows Reading Notes

View the Project on GitHub

Code 201 Reading Notes

Class 6

Class 1 Instructor’s Repo

<== Previous Lesson Next Lesson ==>

<== Home 🏠

The DOM, Domain Modeling, and Introduction to Objects

betterDom

The problem domain is the hardest part of programming

Object Literals (pp.100-105) [Duckett JavaScript]

Using an object literal, you both define and create an object in one statement.

An object literal is a list of name:value pairs (like age:50) inside curly braces {}.

The following example creates a new JavaScript object with four properties:

Example

var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

Using the JavaScript Keyword new

The following example also creates a new JavaScript object with four properties:

Example

var person = new Object();

person.firstName = "John";

person.lastName = "Doe";

person.age = 50;

person.eyeColor = "blue";

In JavaScript, objects are king. If you understand objects, you understand JavaScript.

In JavaScript, almost “everything” is an object.

JavaScript Primitives

A primitive value is a value that has no properties or methods.

A primitive data type is data that has a primitive value.

JavaScript defines 5 types of primitive data types:

Primitive values are immutable (they are hardcoded and therefore cannot be changed).

if x = 3.14, you can change the value of x.

JavaScript objects are containers for named values, called properties and methods.

With JavaScript, you can define and create your own objects.

There are different ways to create new objects:

Objects W3Schools

Document Object Model (pp.183-242) [Duckett JavaScript]

refer to book, it has the best visuals

This topic is huuuuuuuuge oOf. <(^.^)> refer to (pp.239)

What is the DOM? - Medium Article

Reading

From the Duckett JavaScript book:

<== Previous Lesson Next Lesson ==>

<== Home 🏠