You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@shoke2k you are absolutely right, it is a typical interview question
if we enter this code in the browser console it will print => 1
and I think that the contributor who answered this question also saw undefined, which is not correct since this is the default behavior of the browser to print undefined at the finish of the code run
var v = 1
var f1 = function(){
console.log(v)
}
var f2 = function(){
var v = 2;
f1()
}
f2()
FYI printing result from my browser console:
So, @shoke2k let me know if you want to create PR to update the answer to this question
https://github.com/Ebazhanov/in-quiz-questions/blob/master/javascript/javascript-quiz.md#q41-what-will-this-code-print
In the console print 1, in DOM
document.write(f2());
yes, say undefinedThe text was updated successfully, but these errors were encountered: