JavaScript Methods Flashcards

1
Q

Why do we log things to the console?

A

a method for developers to write code to inconspicuously inform the developers what the code is doing / (debug)

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

What is a method?

A

actions that can be performed on objects

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

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

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.floor()

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()

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

shift() or pop()

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() to end or unshift to beginning

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? How would you check if you weren’t sure?

A

they don’t change the original string and to check you would console.log the original variable

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

50ish

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

functions are always because they do not remove the returning values unlike the methods

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

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

A

40ish

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

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

MDM, W3S also helpful

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