In the abstract, rest assured that a problem was solved.
JavaScript One Page
JavaScript operates. This one page presents points to bear in mind when entering a technical exam.
Concepts
let carName; // undefined
Variables defined with var are hoisted to the top, meaning you can use the variable before it is declared.
Use const when you declare:
- A new Array
- A new Object
- A new Function
- A new RegExp
Iterables must implement the Symbol.iterator method. String, Array, TypedArray, Map and Set are all iterables. Their prototype objects have a Symbol.iterator method.
Methods
const myArray = text.split(" ", 3);
let result = text.slice(0, 5);
let result = text.substring(1, 4);
let result = text.substr(1, 4);
x.toString()
(123).toString()
(100 + 23).toString()
Number() Returns a number, converted from its argument
parseFloat() Parses a string and returns a floating point number
parseInt() Parses a string and returns an integer
typeof "John Doe"
typeof (3 + 4)
Loops
for (variable of iterable) { // code block to be executed }
const letters = new Set(["a","b","c"]); for (const x of letters) { // code block to be executed }DOM
document.getElementById("demo").innerHTML = "Hello JavaScript";
document.getElementById("demo").style.fontSize = "35px";
document.getElementById("demo").style.display = "none";