js methods Flashcards
Why do we log things to the console?
To debug and check values
What is a method?
a function in an object
How is a method different from any other function?
needs the object
How do you remove the last element from an array?
array.pop()
How do you round a number down to the nearest integer?
Math.floor()
How do you generate a random number?
Math.random()
How do you delete an element from an array?
array.splice(index, amount)
How do you append an element to an array?
array.push()
How do you break a string up into an array?
array.split()
Do string methods change the original string? How would you check if you weren’t sure?
They do not. They return a value.
Use console.log()
Do string methods change the original string? How would you check if you weren’t sure?
They do not. They return a value.
Use console.log()
Roughly how many string methods are there according to the MDN Web docs?
~50
Is the return value of a function or method useful in every situation?
no, sometimes they do change the original object
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?