Interview trick question JavaScript | Beginners | NodeJS | frontend | backend | global | window

preview_player
Показать описание
In this video we try to understand one of the trick question that is usually asked by interviewers to check if we are paying attention to the code or not.
#Shorts

JavaScript | Window Object | Global Object | Nodejs
Рекомендации по теме
Комментарии
Автор

The variable b is not explicitly declared with let, const, or var inside the fun function. Therefore, b becomes implicitly global.

AshutoshShelkeP
Автор

As a senior js dev sometimes i think wtf is wrong with javascript

rishabhkaushik
Автор

But why is it declared globally? Documentation?

ldsmike
Автор

const fun = () =>{
let a = b = 1
a++
return a
}
console.log(typeof a)
console.log(typeof b)
VM124:6 undefined
VM124:7 undefined

mohitpardhi
Автор

Because of this I lost my dream company 😢

donaa