Javascript functions Flashcards
1
Q
How to return max?
A
Math.max(number, number)
2
Q
How to return min?
A
Math.min(number, number)
3
Q
How to choose a random number between 0 and 0.99?
A
Math.random( )
4
Q
Round down to the nearest integer
A
Math.floor( )
5
Q
Round up to the nearest integer
A
Math.ceil( )
6
Q
Add a new item to an array
A
array.push( thing to push )
7
Q
Creates a new array from calling a function for every array element.
A
newArray = array.map( function )
8
Q
Returns string to upper case
A
string.toUpperCase()
9
Q
Returns string to lower case
A
string.toLowerCase( )
10
Q
Method to return the type of expression
A
typeof thing
11
Q
Return and remove the last value of an array
A
array.pop( )
12
Q
Add a value to the end of an array
A
array.push ( )
13
Q
Object notation
A
let object = {
key: value, key 2: value2, ....
}