Object Oriented Programming Flashcards

1
Q

What is a method?

A

Value of property of an object that is a function

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

How can you tell the difference between a method definition and a method call?

A

method definition has the function keyword and codeblock is in the object literal while method call has parenthesis attached at the end

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

Describe method definition syntax (structure).

A

property name then colon then function definition

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

Describe method call syntax (structure).

A

object dot notation property then parenthesis

object.property()

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

How is a method different from any other function?

A

is within an object

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

What is the defining characteristic of Object-Oriented Programming?

A

based around objects that have data and behavior

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

what are the four “principles” of Object-Oriented Programming?

A

abstraction, encapsulation, inheritance, polymorphism

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

What is “abstraction”?

A

Simplifying a complex method such as turning on/off a lightbulb when in reality it is closing and opening circuits of electricity that give volts to a lightbulb source

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

What does API stand for?

A

Application program interface

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

What is the purpose of an API?

A

communication method between softwares.

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

What is this in JavaScript?

A

refers to the obj

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

What does it mean to say that this is an “implicit parameter”?

A

it means that the parameter is not given but it is not given

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

When is the value of this determined in a function; call time or definition time?

A

call time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
What does this refer to in the following code snippet? 
var character = {
  firstName: 'Mario',
  greet: function () {
    var message = 'It\'s-a-me, ' + this.firstName + '!';
    console.log(message);
  }
};
A

this is undefined until called

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

How can you tell what the value of this will be for a particular function or method definition?

A

no way to know what this

is when a function is called

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

How can you tell what the value of this is for a particular function or method call?

A

check the object left of the call

17
Q

What kind of inheritance does the JavaScript programming language use?

A

prototype intheritances

18
Q

What is a prototype in JavaScript?

A

properties or methods that can be called upon by other

19
Q

How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on objects, arrays, and numbers?

A

inheritance, prototype

20
Q

If an object does not have it’s own property or method by a given key, where does JavaScript look for it?

A

at the next parent prototype, until one is found

21
Q

What does the new operator do?

A

It creates an instance of a user-defined object type

new constructor [([ arguments] )]

22
Q

What property of JavaScript functions can store shared behavior for instances created with new?

A

prototype property

23
Q

What does the instance of operator do?

A

tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object. Return value is a boolean.

24
Q

What is a “callback” function?

A

function called within an argument

25
Q

Besides adding an event listener callback function to an element or the document, what is one way to delay the execution of a JavaScript function until some point in the future?

A

set interval or settimeout

26
Q

How can you set up a function to be called repeatedly without using a loop?

A

setinterval

27
Q

What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?

A

0 or immediately

28
Q

What do setTimeout() and setInterval() return?

A

TimeoutID