Object Oriented Programming Flashcards

1
Q

What is a method?

A

a function attached to an object

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

What does a method do?

A

perform a set of instructions written in the code block

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

What is this?

A

keyword that references the object

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

What does bind do?

A

returns a perman

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

What is the difference between a function and an object literal?

A

functions are objects that can be called

functions have a property named call: on them

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

What is the Prototypal Chain?

A

if javascript cannot find a method/property being called, it will go down the chain (__proto__) looking for that reference

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

What does the new keyword do?

A

Creates a blank, plain JavaScript object;
Links (sets the constructor of) this object to another object;
Passes the newly created object from Step 1 as the this context;
Returns this if the function doesn’t return an object.

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

What is the first thing that happens in a class when it is instantiated with the new keyword?

A

creates an empty object, then

calls the constructor method

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

Since classes are technically functions as well. Can you name a difference between classes and functions?

A

..

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

What is a static method?

A

methods that are attached to the creator object, but not to instantiated objects

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

What is the benefit of instantiating Classes within other classes?

A

so those classes inherit the properties of parents?
establishes a relationship/link between the two classes
(parent-child) relationship

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

Why are parent - child relationships important in OOP?

A

inheritance, reducing a lot of code

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

What is the basic idea of OOP?

A

replicate real life objects with code

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

What decides the order in which JS files must be loaded?

A

the order in which objects require data from other files

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

What is JSON?

A

JSON is a text-based data format following JavaScript object syntax

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

How to you serialize data into a JSON string using JavaScript?

A

JSON.stringify()

17
Q

How do you deserialize a JSON string using JavaScript?

A

JSON.parse

18
Q

What is a client?

A

The client asks for data

19
Q

What is a server?

A

server sends data to client

20
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

Get requests

21
Q

What are the formats of HTTP Requests and Responses?

22
Q

How does ajax work?

23
Q

How do you specify the request method (GET, POST, etc.) when calling ajax?

A

use the method property with value you want (ie “GET”)

24
Q

Why might you need to build elements dynamically with data from an AJAX request?

A

a database of information can change and you have more flexibility with dynamic elements

25
Should you use named functions or anonymous functions for success and error handlers?
generally should use named functions