ReadingNotes

Readings: Problem Domain, Objects, and the DOM

Javascript object basics

Object is a collection of related data/or functionality. Objects usually consists of several variables and functions which are called properties and methods when they are inside objects. You acssed the objects properties and method using dot notation. Bracket Notation provides a different way to access object properties. Dot notation is mostly preferred over bracket because it is more succinct and easie to read. Now there are some cases where you HAVE to use bracket notations like if an object property name is held in a variable, then you can’t use dot notation to access the value, but you can access the value using bracket notation.

JS Questions

  1. Using an object literal will not pollute the global namespace as severely as using many functions declared globally will, and also helps to organise code in a logical fashion

  2. We use arrays whenever we want to create and store a list of multiple items in a single variable. Objects are used to represent a “thing” in your code. That could be a person, a car, a building, a book, a character in a game — basically anything that is made up or can be defined by a set of characteristics.

  3. Whenan object property name is held in a variable, then you can’t use dot notation to access the value, but you can access the value using bracket notation. This is an example of bracket notation being put to use.
  4. “This” refers to the current object the code is being used written inside. In this code “this” is being referred to as dog.

Intro to the DOM

DOM or Document object model is the data representation of the objects that comprise the structure and content of a document on the web. DOM is a programming interface for web documents. It basically represents the web page so that programs can change the document structure, style, and content. DOM isnt a progamming language but without it Javascript wouldnt ouldn’t have any model or notion of web pages, HTML documents, SVG documents, and their component parts. The DOM isnt part of javascript but it instead a web api is used to build websites. If you want to access the DOM you can use the api directly in javscript from within what is called script(a program run by a browser.)

DOM Questions

  1. DOM is a promming interface for web documents.

  2. the relationship between dom and javascript is basically javascript cant show different things without the DOM. Its like a person cant be succesful without help from other people.