Last active
August 29, 2015 14:20
-
-
Save Usse/735009aa07c1b92f4050 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------- 1 -- | |
var bar = 'hello world'; | |
bar = function() { | |
return (function bar() { | |
return bar; | |
}()); | |
} | |
//------- 2 -- | |
var b = [1,2,3,4], | |
c; | |
while(c = b.pop()) { | |
c++; | |
} | |
console.log(c); | |
//------- 3 -- | |
var meal = { | |
starter : 'Home made chips', | |
main : 'Bacon cheeseburger' | |
}; | |
var mealList = [ | |
meal, | |
{starter : 'Home made chips', main : 'Bacon cheeseburger'} | |
]; | |
console.log(meal.main === 'Bacon cheeseburger'); | |
console.log(mealList[0] == mealList[1]); | |
//------- 4 -- | |
var a=0; | |
for (var i = 0; i < 5; i++) { | |
setTimeout(function() { | |
a += 1; | |
}, 0); | |
}; | |
console.log(a); | |
//------- 5 -- | |
var animal = { | |
specie : 'dog', | |
talk : function(sound) { | |
return this.specie + ' ' + sound; | |
} | |
} | |
animal.talk.call(animal, 'barks'); | |
//------- 6 -- | |
var foo = {} | |
Object.defineProperty(foo, 'bar', { | |
value : 'coke', | |
writable : true, | |
enumarable : true, | |
configurable : true | |
}); | |
foo.bar = 'chips'; | |
console.log(foo.bar); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment