Skip to content

Instantly share code, notes, and snippets.

@davit-khaburdzania
Created October 23, 2013 19:44
Show Gist options
  • Save davit-khaburdzania/7125372 to your computer and use it in GitHub Desktop.
Save davit-khaburdzania/7125372 to your computer and use it in GitHub Desktop.
questions about Javascript questions
//1. returned values
(function () {}) === (function () {}) // ==>
(function () {}) == (function () {}) // ==>
(function () {}) == (function () {})() // ==>
(function () {})() == (function () {})() // ==>
(function () {})() === (function () {})() // ==>
(function () {})() == undefined // ==>
(function () {})() == null // ==>
null === (function () {})() // ==>
(function () {})() === undefined // ==>
//2. three ways to generate undefined value
//3. variable shadowing
(function (x) {
console.log(x);
(function () {
var x;
console.log(x);
x = 22
console.log(x);
})();
console.log(x)
})(2)
//4.1 function naming
var viri = function wero () {
console.log(viri);
console.log(wero);
}
viri();
wero();
//4.2 function naming
var x;
console.log(wero())
function wero () {
return x;
}
var x = 22;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment