methods Flashcards

1
Q

Why do we log things to the console?

A

helps to debug and check for issues

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

What is a method?

A

Method is a function which is a property of an object

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

How is a method different from any other function?

A

The difference is that a method is associated with an object, while a function is not.

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

How do you remove the last element from an array?

A

pop() method removes last element from an array and returns that element. changes length of array

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

How do you round a number down to the nearest integer?

A

math.round()

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

How do you generate a random number?

A

math.random() range is 0 to under 1

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

How do you delete an element from an array?

A

splice()

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

How do you append an element to an array?

A

push method pass with no argument

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

How do you break a string up into an array?

A

split()

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

Do string methods change the original string?

A

How would you check if you weren’t sure? original will not change, will generate new one, check in console.log

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

Roughly how many string methods are there according to the MDN Web docs?

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

Is the return value of a function or method useful in every situation?

A

not if you’re trying to pass more functions or methods within the same codeblock.Roughly how many array methods are there according to the MDN Web docs?

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