Last active
November 24, 2020 14:01
-
-
Save marciobarrios/cde0296513eea3799ac2aad117524779 to your computer and use it in GitHub Desktop.
Practical frontend interview
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
(function() { | |
var a = b = 5; | |
})(); | |
console.log(b); | |
// 1. What will be printed on the console? | |
// 2. Rewrite the code to return the same result but with the variable declarations separated | |
// 3. Enable strict mode to explicitly reference the scope |
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
console.log('hello'.repeatify(3)); | |
// 1. Write a method of String that prints 'hellohellohello' |
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
function test() { | |
console.log(a); | |
console.log(foo()); | |
var a = 1; | |
function foo() { | |
return 2; | |
} | |
} | |
test(); | |
// 1. What’s the result of executing this code and why |
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
var fullname = 'Rude Ayelo'; | |
var obj = { | |
fullname: 'Helios Aliaga', | |
prop: { | |
fullname: 'Marcio Barrios', | |
getFullname: function() { | |
return this.fullname; | |
} | |
} | |
}; | |
console.log(obj.prop.getFullname()); | |
var test = obj.prop.getFullname; | |
console.log(test()); | |
// 1. What is the result of the following code? | |
// 2. Fix the previous question’s issue so that the last console.log() prints Marcio Barrios |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment