Learning Fuze Mod 2 - Javascript Flashcards

1
Q

What is a method?

A

a property of an object that contains a function definition

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

one is defined with a body and if it doesn’t have the body its a call

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

Describe method definition syntax (structure).

A

lick: function () {
return ‘mlem’;
}

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

Describe method call syntax (structure).

A

object.method()

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

its pre defined

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

object’s own procedures can access and often modify the data fields of itself

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

a way of representing a complex process with a series of steps

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

What does API stand for?

A

Application programming 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

a way for programs to communicate with each other

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

What is this in JavaScript?

A

a JavaScript keywords that references the current object. It has different values depending on where it is used: In a method, this refers to the owner object. Alone, this refers to the global object. In a function, this refers to the global object.

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

The implicit parameter in Java is the object that the method belongs to. It’s passed by specifying the reference or variable of the object before the name of the method.

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?

A
  1. the character object.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Given the above character object, what is the result of the following code snippet? Why?

A
  1. its a me mario!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Given the above character object, what is the result of the following code snippet? Why?

A

3.it’s a me undefined!, because its a stand alone function so “this” would be refering to the window

17
Q

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

A

you can guess if its used as you intended for it to be used

18
Q

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

A

for a function its a window

for a method if its a property of an object than its the object if its a nothing then its the window

19
Q

What kind of inheritance does the JavaScript programming language use?

A

prototype based inheritance

20
Q

What is a prototype in JavaScript?

A

where JavaScript looks for a property if the object itself doesn’t have it

21
Q

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

A

they are all represented by objects

22
Q

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

A

it looks at the prototype of the current object

23
Q

What does the new operator do?

A

lets developers create an instance of a user-defined object type or of one of the built-in object types that has a constructor function

24
Q

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

A

prototype property

25
Q

What does the instanceof operator do?

A

used to test if an object is of a given type(a descendant of). The result of the operation is either true or false

26
Q

what is a callback function?

A

a function that is passed in another function as an argument

27
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

using the setTimeout() method

28
Q

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

A

setInterval() method

29
Q

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

A

0
and no set timeout will be the last thing to run if you have other code, for example, a function that has to run 1000x, that will run first, and then after it’s done the setTimeout() method will run. it pretty much prioritizes whatever is in setTimeout() at 0

30
Q

What do setTimeout() and setInterval() return?

A

it returns an interval ID

of the data type number