ProghubPH
Вопрос из теста JavaScript основы
JS / junior

Что выведет следующий код:

 один вариант
var var1 =12; 
(function SelfExecutedTestFun(){ 
  console.log("value of var1 is:" + var1); 
  var var2 = 500; 
})(); 
console.log("value of var1 from out side is:" + var1); 
console.log("value of var2 from out side is:" + var2); 
"value of var1 is: null" "value of var1 from out side is:12" "value of var2 from out side is:500"
"value of var1 is: 12" "value of var1 from out side is:12" "value of var2 from out side is:500"
"value of var1 is: 12" "value of var1 from out side is:12" "ReferenceError: var2 is not defined"
"ReferenceError: var1 is not defined" "value of var1 from out side is:12" "value of var2 from out side is:500"