JS METHODS Flashcards
Why do we log things to the console?
To debug and test
What is a method?
A method is a function which is a property of an object.
There are two kinds of methods:
instance methods which are built-in tasks performed by an object instance, or
static methods which are tasks that are called directly on an object constructor.
How is a method different from any other function?
Methods involve assosication with an object
How do you remove the last element from an array?
pop
How do you round a number down to the nearest integer?
floor
How do you generate a random number?
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?
Yes, 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?
Yes, depends on what
Roughly how many array methods are there according to the MDN Web docs?
Alot
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN