JS Methods Flashcards

1
Q

What is a method?

A

A function that is a property of an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
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
3
Q

How do you remove the last element from an array?

A

Array.pop()

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

How do you delete an element from an array?

A

Array.splice()

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

How do you break a string up into an array?

A

Object.split()

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

How do you append an element to an array?

A

Array.push()

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

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

A

About 30ish.

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

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

A

About 30ish.

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

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

A

MDN

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

No? But if you’re not sure check MDN <b><i>OR</i></b> log it into the console and try it yourself.

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

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

A

No. Sometimes you don’t need to save returns.

Only save the ones you need.

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

How is a method different from any other function?

A

The syntax is different. The function is called with the object.

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

Why do we log things to the console?

A

It is a great learning tool (use it to play and learn about JavaScript).
Also used as a debugging tool during app development.

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

How do you generate a random number?

A

Math.random() — Think of it as a range between 0 and 1 (not inclusive of 1); so you get decimal (think of decimal as a percentage)

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