Javascript Flashcards
What is .toISOString() for
The toISOString() method converts a Date object into a string, using the ISO standard.
The standard is called ISO-8601 and the format is: YYYY-MM-DDTHH:mm:ss.sssZ
what is .toLocalString() for
The toLocaleString() method converts a Date object to a string, using locale settings.
The default language depends on the locale setup on your computer.
What does CRUD stand for
Create Read update delete
Truthy
A truthy value is a non-Boolean value that evaluates to true in a Boolean context
Falsy
A falsy value is a non-Boolean value that evaluates to false in a Boolean context
conditional operator
Condition ? Expression1 : Expression2
Switch Statement
The switch statement evaluates an expression, matching the expression’s value to a case clause, and executes statements associated with that case, as well as statements in cases that follow the matching case.
const expr = 'Papayas'; switch (expr) { case 'Oranges': console.log('Oranges are $0.59 a pound.'); break; case 'Mangoes': case 'Papayas': console.log('Mangoes and papayas are $2.79 a pound.'); // expected output: "Mangoes and papayas are $2.79 a pound." break; default: console.log(`Sorry, we are out of ${expr}.`); }
Local scope
A variable declared inside a function has local scope, so only the function that defines the variable has access to the local variable
global scope
A variable declared outside a function has global scope, and all functions have access to a global variable
The var Keyword and Scope - inside function
A variable declared inside a function with var has function scope: the variable is accessible anywhere within the function, but not outside
let scope
A variable declared inside a function with let has block scope: the variable is accessible only within the enclosing pair of braces
What does math.floor() do
Returns a whole integer
what does
document.writeln(“<div>test</div>”) do
adds the child to the DOM
what does window.location access
is a location object that contains information about the window’s current URL
what does window.navigator access
is a navigator object that contains information about the browser
what does window.innerHeight and window.innerWidth access
the windows dimensions in pixels