Skip to content

Instantly share code, notes, and snippets.

@biirus
biirus / question_10.js
Last active March 10, 2017 07:28
Q10 #tags: interview
function getObject()
{
return
{
subject: 'Human',
kingdom: 'Animalia',
phylum: 'Chordata',
class: 'Mammalia',
order: 'Primates',
}
@biirus
biirus / question_9.js
Last active March 10, 2017 07:29
Q9 #tags: interview
var child = {
age: 3,
name: 'Ivan',
hello: function () {
console.log(this.name + ', ' + this.age);
}
};
child.hello();
setTimeout(child.hello, 1000);
@biirus
biirus / question_8.js
Last active March 10, 2017 07:29
Q8 #tags: interview
add (5, 2); // 7
add (5)(3); // 8
@biirus
biirus / question_7.js
Last active March 10, 2017 07:29
Q7 #tags: interview
var x = 1;
(function () {
var x = 2;
f();
})();
function f () {
console.log(x);
}
@biirus
biirus / question_6.js
Last active March 10, 2017 07:29
Q6 #tags: interview
var i, btn;
for (i = 0; i < 3; i++) {
btn = $('<input/>', {type: 'button'});
btn.click(function () {
console.log(i);
});
$('body').append(btn);
@biirus
biirus / question_5.js
Last active March 10, 2017 07:29
Q5 #tags: interview
+function () {
var x = a = 2;
}();
console.log(a);
console.log(x);
@biirus
biirus / question_4.js
Last active March 10, 2017 07:29
Q4 #tags: interview
function a () {
var x = 1;
function x () {
return 2;
}
return x;
}
@biirus
biirus / question_3.js
Last active March 10, 2017 07:29
Q3 #tags: interview
function a () {};
var a = function () {};
var a = function b () {};
@biirus
biirus / question_2.js
Last active March 10, 2017 07:30
Q2 #tags: interview
var x = 1;
function a () {
if (x) {
var x = 2;
}
return x;
}
@biirus
biirus / question_1.js
Last active March 10, 2017 07:30
Q1 #tags: interview
var x = 1;
function a () {
var x = 2;
return x
}
a();
console.log(x);