Rithm (Intro to JS) Flashcards
What is the difference between JavaScript and ECMAScript?
ECMAScript is a standard. JavaScript is an implementation of that standard. The standard dictates certain features and sets of functionality, but there can be different implementations that follow the standard. There are many different JavaScript engines that implement the ECMAScript standard and are competing for dominance; the most popular right now is Google’s V8 engine.
Who is the creator of JavaScript?
Brendan Eich, who was working at Netscape at the time and now works at Mozilla.
When was JavaScript created?
May 1995
How long did it take to create JavaScript?
10 days
What was JavaScript called before it was named “JavaScript”?
Mocha, a name chosen by Marc Andreessen, founder of Netscape. In September of 1995 the name was changed to LiveScript, then in December of the same year, upon receiving a trademark license from Sun, the name JavaScript was adopted.
What are the primitive data types?
String, Number, Boolean, undefined
, null
What is the difference between null
and undefined
?
https://stackoverflow.com/questions/5076944/what-is-the-difference-between-null-and-undefined-in-javascript
What does typeof null
return?
“object”
How do you convert a string into a number? Is there a shorthand method to do this?
using Number.parseInt() or Number.parseFloat()
parseInt("2"); // 2 parseFloat("2"); // 2 parseInt("3.14"); // 3 parseFloat("3.14"); // 3.14 parseInt("2.3alkweflakwe"); // 2 parseFloat("2.3alkweflakwe"); // 2.3 parseInt("w2.3alkweflakwe"); // NaN (not a number) parseFloat("w2.3alkweflakwe"); // NaN (not a number)
Using the Number() function or the unary operator (+).
+“2”; // => 2
+“3.14”; // => 3.14
+“2.3alkweflakwe”; // => NaN
+“w2.3alkweflakwe”; // => NaN
What does 5 == "5"
return? Why?
Returns true
; the string gets coerced into a number and thus 5 === 5 => true
What does "true" == true
return? Why?
the boolean true gets coerced to a number (1), and then “true” is compared to 1, which returns false.
What are the SIX falsey values?
- 0
- ””
- null
- undefined
- false
- NaN
What happened when you use the Array.prototype.delete() method?
delete() does not function the same way shift()/pop() does; delete() will delete the value at the index passed into the method and replace the value with ‘undefined’.
What arguments does the Array.prototype.splice() method accept?
splice() accepts at least two arguments:
1) the starting index
2) the number of elements to be removed/replaced
3) (optional) an unlimited amount of args to be added into the array
What is the syntax for a do .. while loop? What is the difference between that and a regular while loop?
let i = 0; do { console.log(i); i++; } while (i < 5);
The code inside a do .. while loop is guaranteed to run at least once.