Javascript methods Flashcards
Why do we log things to the console?
Debug and check output
What is a method?
Function that is a property of an object
How is a method different from any other function?
They belong to the property of an object while a function can be declared anywhere in the global scope.
How do you remove the last element from an array?
.pop()
How do you round a number down to the nearest integer?
Math.round()
How do you generate a random number?
Math.random()
How do you delete an element from an array?
.splice()
How do you append an element to an array?
.push()
How do you break a string up into an array?
.split()
Do string methods change the original string? How would you check if you weren’t sure?
It doesn’t. console.log()
Roughly how many string methods are there according to the MDN Web docs?
More than 40
Is the return value of a function or method useful in every situation?
No, it doesn’t. Functions are usually broken down into return values and those that perform an action.
Roughly how many array methods are there according to the MDN Web docs?
More than 30
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN