Javascript-methods Flashcards
Why do we log things to the console?
it’s debugging tool to check if your code works.
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?
a methods is associated with an object and function is not.
How do you remove the last element from an array?
the pop() method.
How do you round a number down to the nearest integer?
The Math.floor() function
How do you generate a random number?
The Math.random() function
How do you delete an element from an array?
The splice() method
How do you append an element to an array?
The push() method (to add elements to the end) or the unshift() method (to add elements to the beginning) of an array,.
How do you break a string up into an array?
The split() method
Do string methods change the original string? How would you check if you weren’t sure?
strings do not change, string method generates a new string, and use console.log to check the output.
Roughly how many string methods are there according to the MDN Web docs?
About 50.
Is the return value of a function or method useful in every situation?
it’s not always useful.
Roughly how many array methods are there according to the MDN Web docs?
About 40.
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN