Javascript functions Flashcards

1
Q

How to return max?

A

Math.max(number, number)

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

How to return min?

A

Math.min(number, number)

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

How to choose a random number between 0 and 0.99?

A

Math.random( )

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

Round down to the nearest integer

A

Math.floor( )

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

Round up to the nearest integer

A

Math.ceil( )

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

Add a new item to an array

A

array.push( thing to push )

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

Creates a new array from calling a function for every array element.

A

newArray = array.map( function )

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

Returns string to upper case

A

string.toUpperCase()

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

Returns string to lower case

A

string.toLowerCase( )

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

Method to return the type of expression

A

typeof thing

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

Return and remove the last value of an array

A

array.pop( )

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

Add a value to the end of an array

A

array.push ( )

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

Object notation

A

let object = {

key: value, 
key 2: value2,
.... 

}

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