-
-
Save khadorkin/9131b8b13d6855d7dda1ea615c9faaf5 to your computer and use it in GitHub Desktop.
FE Test
This file contains hidden or 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
(function() { | |
console.log(abc); | |
var abc = "abc"; | |
console.log(myFunc()); | |
function myFunc() { | |
var def = abc + 'def'; | |
return def; | |
} | |
})(); |
This file contains hidden or 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
function loop() { | |
for (var i = 0; i < 5; i++) { | |
setTimeout(function() { | |
console.log(i); | |
}, i * 1000); | |
} | |
} | |
loop(); |
This file contains hidden or 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
(function() { | |
console.log(1); | |
setTimeout(function() { | |
console.log(2); | |
}, 1000); | |
setTimeout(function() { | |
console.log(3); | |
}, 0); | |
console.log(4); | |
})(); |
This file contains hidden or 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
// Array.prototype.map | |
var persons = [ | |
{ | |
id: 1, | |
name: "John Smith", | |
}, | |
{ | |
id: 2, | |
name: "Sam Nilson", | |
}, | |
... | |
]; | |
function getNames(persons) { | |
... | |
} | |
console.log(getNames(persons)); | |
// [{ | |
// id: 1, | |
// firstName: "John", | |
// lastName: "Smith" | |
// }, ...] | |
// Array.prototype.filter & Array.prototype.every | |
var numbers = [2, 4, 6, 7, 8, 10, 13]; | |
function getOddNumbers(numbers) { // нечетные | |
... | |
} | |
var oddNumbers = getOddNumbers(numbers); // array | |
function isAllNotBiggerThan100(numbers) { | |
... | |
} | |
var isNotBiggerThan100 = isAllNotBiggerThan100(numbers); // boolean |
This file contains hidden or 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
function func() { | |
this.name = "John"; | |
} | |
var a = func(); // a? this? | |
var b = new func(); // b? this? | |
var c = { | |
name: "Sam", // writable: false | |
sayName: function () { | |
console.log(this.name); | |
} | |
} | |
var d = ...; | |
d(); // => "John" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment