javascript-methods Flashcards
Why do we log things to the console?
To see if the code ran right
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 method is actually an object reference to a function.
How do you remove the last element from an array?
The pop() method
How do you round a number down to the nearest integer?
Math.The floor()
How do you generate a random number?
Math.random()
How do you delete an element from an array?
splice() pass it the index
How do you append an element to an array?
push() or unshift()
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?
Use concle.log to check All string methods return a new string. They don’t modify the original string.
Roughly how many string methods are there according to the MDN Web docs?
36
Is the return value of a function or method useful in every situation?
No, Examples of not needing would be splice,pop,shift
Roughly how many array methods are there according to the MDN Web docs?
40
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN