alert("Start"); // *************************************************************************************** alert("Test 1.1: " + typeof Array); alert("Test 1.2: " + typeof Array.prototype); alert("Test 1.3: " + typeof Array.prototype["push"]); // *************************************************************************************** var n = ""; if (n) { alert("Test 2.1: " + 'true'); } else { alert("Test 2.1: " + 'false'); } alert("Test 2.2: " + (null == undefined)); alert("Test 2.3: " + (n == !!n)); // ****************************************************************************** alert("Test 3: " + ({}.a != {}.b)); // **************************************************************************************** function C() { } Ca = 2; var g = new C(); alert("Test 4: " + ga); // **************************************************************************** var s = {a: 0}; s.prototype = {b: 1}; alert("Test 5: " + (sa == sb)); // ******************************************************************************* function A() { this.a = 4; } A.prototype = {a: 2}; var x = new A({a: 7}); alert("Test 6.1: " + Aa); alert("Test 6.2: " + xa); // *********************************************************************************** var a; function func(arg) { if (arg < 0) { return 1; } else if (arg > 0) { return 2; } else if (arg == 0) { return 3; } } var b = func(a); alert("Test 7: " + b); // ********************************************************************************* try { var tst = 5 / 0; if (tst > NAN) { throw new Error('bigger'); } else if (isFinite(tst)) { throw 'lower'; } throw 0; } catch (e) { alert("Test 8: " + (e.toString())); } // ****************************************************************************** var x = undefined; alert("Test 9.1: " + (this['x'] === x)); alert("Test 9.2: " + (this['x'] === undefined)); alert("Test 9.3: " + this.hasOwnProperty('undefined')); // ****************************************************************************** function B(arg) { this.a = arg; } B.prototype = {a: 1}; Ba = 4; var m = new B(3); var j = new B(); alert("Test 10: " + ma + ja); // ******************************************************************************
Source: https://habr.com/ru/post/253033/
All Articles