58
loading...
This website collects cookies to deliver better user experience
C
, C++
and Java
but semantically this is not similar which makes developers confused. Another weird thing to mention is its prototype inheritance
which can be achieved similarly using es6 class. Let us discuss some interesting facts about this very language.;var a = 2
;console.log(a)
var b = 5 + '9';
console.log(b);
NaN == NaN // -> false
NaN === NaN // -> false
[] == true // -> false
[] === true // -> false
[] == false // -> true
[] === false // -> false
{} == {} // -> false
{} === {} // -> false
{} >= {} // -> true
{} > {} // -> false
(function() {
console.log('works well');
})();
function() {
console.log('generates syntax error');
}();
SyntaxError
.function f1() {
return
{
grade: 'A+'
}
}
function f2() {
return {
grade: 'A+'
}
}
typeof f1() === typeof f2(); // -> false
undefined
is not a reserved word although it a has a special meaning. This is the only way to determine whether a variable is undefined but the following code snippet looks quite weird.
undefined = "I am defined now!";
var c;
console.log(c == undefined); // -> false