javascript-methods Flashcards
Why do we log things to the console?
To show what the code is doing.
What is a method?
A method is a function which is a property of an object.
How is a method different from any other function?
The difference is that a method is associated with an object, while a function is not.
How do you remove the last element from an array?
pop method of the Array object
How do you round a number down to the nearest integer?
floor method of the Math object
How do you generate a random number?
random method of the Math object
How do you delete an element from an array?
- splice method of the Array object
- pop method of the Array object
- shift method of the Array object
How do you append an element to an array?
push method of the Array object
How do you break a string up into an array?
split method of the String object
Do string methods change the original string? How would you check if you weren’t sure?
- No
- console.log
Roughly how many string methods are there according to the MDN Web docs?
30
Is the return value of a function or method useful in every situation?
No
Roughly how many array methods are there according to the MDN Web docs?
30
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN