Mod 1 -2 Flashcards

1
Q

What are function expressions?

A

function expressions are a syntax structure that allow for simple functions to be written anonymously or with an arrow function:

  • let sayHi = function() {
    alert( “Hello” );
    };
  • x => x%2

They can even be assigned to a variable

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

List all JS data types

A

-numbers
-boolean
-string
-symbol
-special
-object (includes arrays)

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

What are the 4 parts of an HTTP response?

A

Hypertext Transfer Protocol Response

  1. Status line
    (HTTP/version status-code reason-phrase)
  2. Response headers
  3. Blank line
  4. Body (w/ resource)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 4 parts of an HTTP request?

A

Hypertext Transfer Protocol Request

  1. Request Line
    (Request method Resource Http/version)
  2. Request Headers
  3. Blank line
  4. Body (additional data)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 6 parts of a URL

A

Uniform Resource Locator

  1. Scheme
  2. Server name
  3. Port number
  4. Path to resource
  5. Query parameters
  6. Anchor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 3 components of a URL?

A

Uniform Resource Locator

  1. Scheme or protocol
  2. Hostname
  3. Resource name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is CSS?

A

Cascading Style Sheet

A method used for describing the presentation and style of webpages while HTML is used for structure

Allows customization for screen size

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

What is HTML?

A

Hypertext Transfer Protocol

A markup language to describe web documents.

The client interprets HTML from an HTTP response in order to display a web document.

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

In JS, what is a free variable?

A

In javascript closures, free variables are simply the variables that the function takes (read and write) in the enclosing scope where is declared the closure or in a parent scope.

Look at this real world example :

Gol.prototype._ensureInit = function() {

var _this = this;
var setDim = function() {
_this.w = _this.canvas.clientWidth;
_this.h = _this.canvas.clientHeight;
_this.canvas.width = _this.w;
_this.canvas.height = _this.h;
_this.dimChanged = true;
_this.draw();
};
setDim();
window.addEventListener(‘resize’, setDim);

};
In this example a closure points from the setDim function towards the variable _this declared in the enclosing scope (the _ensureInit function). This variable isn’t declared in setDim nor passed. It’s a “free variable”.

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

In JS, what is a closure?

A

A closure is a function having access to the parent scope, even after the parent function has closed.

In other words, a closure gives you access to an outer function’s scope from an inner function or to a free variable.

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

In JS, what is a constructor look like?

A

The constructor method is a special method of a class for creating and initializing an object instance of that class.

class Polygon {
constructor() {
this.name = ‘Polygon’;
}
}

const poly1 = new Polygon();

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

In JS, what is a higher order function?

A

Higher order functions are functions that take one or more functions as arguments, or return a function as their result

// Callback function, passed as a parameter in the higher order function
function callbackFunction(){
console.log(‘I am a callback function’);
}

// higher order function
function higherOrderFunction(func){
console.log(‘I am higher order function’)
func()

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

What is HTML?

A

HyperText Markup Language is the language used to describe the structure and meaning of webpages.

HyperText refers to documents that link to one another.

The other piece is that it is a Markup Language. This means that it is basically a language to describe webpages. This is distinct from a programming language that allows for the use of logic and control structures.

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