In continuation with the previous article regarding JS interview questions, here is the part 2 of the series of interview questions that I generally ask folks while interviewing them for any JS SDET/JS QA Automation Engineer interviews.
Can you shed some light on the data types that exist in Javascript?
Ans: There are two different types of data types available in JS. Let’s take a look at them one by one –
- Primitive Types
There are some data types which are called Primitive data types in JS. A string, number etc. comes under such type. Primitive data types are –
String
Number
Boolean
BigInt
Undefined
Null
Symbol
- Non Primitive Types
Non Primitive data types are the ones that can store more than one values. Non-primitive data types are used for storing complex data values.
Examples of Non Primitive data types are
Object
Arrays
Imp: In Javascript, if the data type of any data is not primitive, then it will be a Object type by default.
What is a NaN property in JS?
Ans: In JS, a Not A Number or NaN is a check to see if the data is not a legal number.
We have the isNaN()
method in JavaScript to check for NaN property. Also the typeof
NaN is number
.
for e.g see the image below

Can you explain passed by value and passed by reference in JS
What is IIFE and why is it important?
Give an example of this keyword in JS
What is scope in JS and what is a scope chain?
I’ve discussed this one in detail here – post.