Javascript Flashcards
Difference between var and let
var is not scope attached, let is scope attached
Does Javascript supports autoconversion?
Yes
“This” in a method
Refers to the owner scope, or to the global scope
Style from HTML
document.getElementById(“id”).style.fontSize
Class from HTML
document.getElementById(“id”).className
“This” alone
Refers to the global scope
“This” in an event
Refers to the element that receives the event
setTimeout()
Receives function and delay in miliseconds. Call function after delay.
setInterval()
Receives function and delay in ms. Repeat function in the said delay time.
clearInterval()
Receives the id from the interval. Stops the interval.
What does sort() by default?
Sorts an array alphabetical and ascending.
How to sort numeric arrays?
(a, b) => a-b , this will sort ascending.
unshift()
Adds new elements to the beginning of an array. Overwites the original array. Returns the new lenght of the array.
push()
Adds new items to the end of an array.Overwites the original array. Returns the new lenght of the array.
shift()
Removes the first item of an array. Changes the original array. Returns the shifted element.