Javascript-methods Flashcards
Why do we log things to the console?
- Only for development and not in the production phase… (strictly for debugging and see the values).
What is a method?
- function attached to an object as a property
How is a method different from any other function?
- Syntax. function –> free floating, methods –> have to tell where the function came from.
How do you remove the last element from an array?
pop() method
How do you round a number down to the nearest integer?
- round
How do you generate a random number?
- Math.random() –> between 0 and 1 (but not 1) up to .99999999999
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?
- No.
2. try it on the code.
Roughly how many string methods are there according to the MDN Web docs?
Check online. we will not use all of them!!
mid 40
Is the return value of a function or method useful in every situation?
No.
Roughly how many array methods are there according to the MDN Web docs?
Check online. (roughly about 30).
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN!!!!!