javascript-methods Flashcards
Why do we log things to the console?
To see the value of the outcome while we are still building the application. Debugging it.
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?
Syntax. Method is used with an object.
How do you remove the last element from an array?
pop() method.
How do you round a number down to the nearest integer?
Using the Math.floor() function
How do you generate a random number?
Using the Math.random() function
How do you delete an element from an array?
With the splice() method
How do you append an element to an array?
With the push() method
How do you break a string up into an array?
With split() method and parameter deleteCount
Do string methods change the original string? How would you check if you weren’t sure?
String methods don’t change the original string.
One could check by writing the code/trying/experimenting.
Roughly how many string methods are there according to the MDN Web docs?
Many (we should look into the documentation - MDN documentation).
Is the return value of a function or method useful in every situation?
Not in every situation.
Roughly how many array methods are there according to the MDN Web docs?
Many (we should look into the documentation - MDN documentation).
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN