Here is the one of the topics in JavaScript Tutorial provided by International…
- User
Here is the one of the topics in JavaScript Tutorial provided by International JavaScript Institute. UNDEFINED The undefined type is a data type of a special value undefined which is the only one value of this type. The undefined is predefined global variable and is initialized to the undefined value. It indicates that value is not defined. This value is returned: By a variable that is declared but not initialized, Referring to an object property that does not exist, Referring to an array element that does not exist. var x; var y = [10, 20]; var z = {alpha: 33}; //var v; console.log(x); // undefined console.log(y[1]); // 20 console.log(y[3]); // undefined console.log(z.alpha); // 33 console.log(z.beta); // undefined console.log(v); // ReferenceError Note that by referring to a variable that has not been declared, the undefined value will not be returned but an ReferenceError is thrown. Based on this information create for quiz with 15 questions. Each question should have 4 different variants of answer. Multiple answers for one question can be correct.
- Assistant
- User
Here is the one of the topics in JavaScript Tutorial provided by International JavaScript Institute. SYMBOL Symbols are new primitive type added in ECMAScript 2015. Symbols do not have a literal syntax, they have a Symbol() function that can be used to create them. Symbol() function is rather a factory, it is not a constructor. The function takes one optional argument description.
var symbol = new Symbol('symbol'); // TypeError: Symbol is not a constructor // correct way: var symbol = Symbol('mySymbol'); console.log(symbol); // Symbol(mySymbol) Symbols are unique. Each new symbol has new, unique value. If you create new symbols:
var mySymbol = Symbol(); var mySymbol2 = Symbol(); JavaScript engine creates a completely new values for them. It means that:
Symbol() === Symbol() // false
The use of Symbols Symbols may be used as unique property keys. They prevent name clashes.
var p1 = Symbol('p'); var p2 = Symbol('p'); var p3 = Symbol('p'); var object = { [p1]: 1, [p2]: 2, }; object[p3] = 3; They may be used as constants representing concepts:
const CATEGORY_PHONES = Symbol('phones'); const CATEGORY_LAPTOPS = Symbol('laptops'); const CATEGORY_TV = Symbol('tv'); const CATEGORY_CONSOLES = Symbol('consoles'); Based on this information create for quiz with 15 questions. Each question should have 4 different variants of answer. Multiple answers for one question can be correct.
- Assistant