The most repeated questions I met with on job interviews (part 1) - edited

The most repeated questions I met with on job interviews (part 1) - edited

A wise man once said: "If you can not explain it, you do not understand it". A few years ago, when I had searched for a job as a student I went through a lot of interviews. For web positions related to Javascript, there were some questions that repeat regularly. And it makes sense, to ask them also today.

const vs let vs var

const keyword creates block scope variable and prevents its value to be reassigned by a new value. However, important thing is that it does not restrict changing the internal state of the object. image

let is block-scope variable while var is function-scope variable. image

'===' vs '==' comparison

=== is strict comparison, it checks value and type of value as well, so 1 === "1" returns false, the opposite of that is == comaparison which checks only value so 1 == "1" returns true.

Can we compare two objects with '===' ?

NO. Object is reference type. Two distinct object never be equal even they have same property. That's why you will get false when you are using '===' comparison. In Javascript also exist built-in function Object.is(value1, value2).

Follow me on Twitter

Resources

Eloquent Javascript unsplash.com/photos/TFFn3BYLc5s?utm_source=..