W3. The DOM Flashcards

1
Q

How does parameter passing work in JS for base types and object types?

A
Base types (String, Number,  Boolean) passed by value.
Object types (Object, Function, Array) passed by reference.
(Parameters are un-typed)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does DOM stand for?

A

Document Object Model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In the DOM, what does the Window object refer to?

A
  • The OS window hosting the page
  • global object in JS program when it is executed in a browser
  • contains other objects including document, navigator and screen and references to other windows and frames
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In the DOM, what does the Navigator object refer to?

A
Browser application in use
Includes: 
- name of browser
- platform (e.g MacIntel)
- language of browser (e.g. english)
- if browser is online
- geolocation
- cookie info
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In the DOM, what does the Screen object refer to?

A
Physical monitor in use
Properties:
- width 
- height
- colourDepth
- pixelDepth etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In the DOM, what does the Document object refer to?

A
  • currently displayed HTML
  • root of the DOM tree (parent of tag)
  • always directly accessible via JS
    (lots of methods e.g. getElementById)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In the DOM, what does the Node class refer to?

A
Class that most objects in DOM inherit from
Properties:
- childNodes
- firstChild
- lastChild
- nextSibling
- parentNode etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does JSON stand for?

A

JavaScript Object Notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is JSON used for?

A
  • syntax for storing and exchanging data
  • text, written with JS object notation
  • easy conversion from/to JS objects
  • can be sent between browser and server
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What 2 methods are there for converting between JSON and JS?

A

.stringify - to convert to a JSON string

.parse - to convert to a JS object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a WebSocket?

A
  • provides (full-duplex) communication over a TCP connection between web browser and web server
    (data moves in both directions)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do WebSockets allow two-way communication between client and server?

A
  • have a standardised way of allowing the server to send content to the client without it first being requested by client
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List 4 WebSocket events

A
  • on open
  • on error
  • on close
  • on message
How well did you know this?
1
Not at all
2
3
4
5
Perfectly