JavaScript Methods Flashcards
Why do we log things to the console?
a method for developers to write code to inconspicuously inform the developers what the code is doing / (debug)
What is a method?
actions that can be performed on objects
How is a method different from any other function?
method is associated with an object, while a function is not
How do you remove the last element from an array?
pop() method
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?
shift() or pop()
How do you append an element to an array?
push() to end or unshift to beginning
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?
they don’t change the original string and to check you would console.log the original variable
Roughly how many string methods are there according to the MDN Web docs?
50ish
Is the return value of a function or method useful in every situation?
functions are always because they do not remove the returning values unlike the methods
Roughly how many array methods are there according to the MDN Web docs?
40ish
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDM, W3S also helpful