Repeated questions I met with on job interviews (part 1)

A wiseman 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 which repeat…

A wiseman 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 which repeat regularly. And it makes sense, to asked them also today.



const vs let vs var

const keyword create block scope variable and prevents its value to be reassigned by a new value. However, important thing is that it does not restrict to change 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 check 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 exist built-in function Object.is(value1, value2) which returns true if objects are equals, otherwise it returns false.



Resources

Eloquent Javascript
https://unsplash.com/photos/TFFn3BYLc5s?utm_source=unsplash&utm_medium=referral&utm_content=creditShareLink


Print Share Comment Cite Upload Translate
APA
Jakub Smetanka | Sciencx (2024-03-29T11:46:27+00:00) » Repeated questions I met with on job interviews (part 1). Retrieved from https://www.scien.cx/2021/09/19/repeated-questions-i-met-with-on-job-interviews-part-1/.
MLA
" » Repeated questions I met with on job interviews (part 1)." Jakub Smetanka | Sciencx - Sunday September 19, 2021, https://www.scien.cx/2021/09/19/repeated-questions-i-met-with-on-job-interviews-part-1/
HARVARD
Jakub Smetanka | Sciencx Sunday September 19, 2021 » Repeated questions I met with on job interviews (part 1)., viewed 2024-03-29T11:46:27+00:00,<https://www.scien.cx/2021/09/19/repeated-questions-i-met-with-on-job-interviews-part-1/>
VANCOUVER
Jakub Smetanka | Sciencx - » Repeated questions I met with on job interviews (part 1). [Internet]. [Accessed 2024-03-29T11:46:27+00:00]. Available from: https://www.scien.cx/2021/09/19/repeated-questions-i-met-with-on-job-interviews-part-1/
CHICAGO
" » Repeated questions I met with on job interviews (part 1)." Jakub Smetanka | Sciencx - Accessed 2024-03-29T11:46:27+00:00. https://www.scien.cx/2021/09/19/repeated-questions-i-met-with-on-job-interviews-part-1/
IEEE
" » Repeated questions I met with on job interviews (part 1)." Jakub Smetanka | Sciencx [Online]. Available: https://www.scien.cx/2021/09/19/repeated-questions-i-met-with-on-job-interviews-part-1/. [Accessed: 2024-03-29T11:46:27+00:00]
rf:citation
» Repeated questions I met with on job interviews (part 1) | Jakub Smetanka | Sciencx | https://www.scien.cx/2021/09/19/repeated-questions-i-met-with-on-job-interviews-part-1/ | 2024-03-29T11:46:27+00:00
https://github.com/addpipe/simple-recorderjs-demo