javascript-methods Flashcards
Why do we log things to the console?
“console. log” specifically is a method for developers to write code to inconspicuously inform the developers what the code is doing
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, like a function, is a set of instructions that perform a task. The difference is that a method is associated with an object, while a function is not.
How do you remove the last element from an array?
The “pop() method” is used to remove the last element from an array.
How do you round a number down to the nearest integer?
The “Math.floor()” method rounds a number down to the nearest integer.
How do you generate a random number?
The “Math.random()” method generates a random number.
How do you delete an element from an array?
The “.splice() method” deletes an element from an array.
How do you append an element to an array?
The “push() method” appends an element to an array.
How do you break a string up into an array?
The “split() method” breaks a string up into an array.
Do string methods change the original string? How would you check if you weren’t sure?
The replace function returns the new string with the replaces, but if there weren’t any words to replace, then the original string is returned.
Roughly how many string methods are there according to the MDN Web Docs?
There are around sixty string methods are there according to the MDN Web Docs.
Is the return value of a function or method useful in every situation?
Function only has to return a value if the return type of the function in non void.
For example, if the return type is int, float, double etc.
Roughly how many array methods are there according to the MDN Web Docs?
There are around fifty array methods are there according to the MDN Web Docs.
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property is “MDN”.