Top 10 Javascript basic interview questions and answers

Ms Chi
3 min readJul 21, 2022
Basic Interview questions

It is fine if we do not KNOW everything but we must master the basic stuff. With robust base knowledge, your coding skill will be MORE convincing. Thus, fundamental knowledge questions are always be asked in the first stage of technical interview.

1. What is the difference between ‘===’ and ‘==’?

It is about type coercion. However, if the candidate talks about type validation, it should be considered a red flag. ‘==’ allows necessary type conversion but ‘===’ does not.

2. What is the difference between ‘null’ and ‘undefined’?

We assign a declared variable with ‘null’ value. However, a variable is ‘undefined’ when no value is assigned for that variable.

3. What is the expected output from this code?

[1,1000,6,4,1].sort()

It will be considered a red flag if candidate did not mention an implementation must be inserted to avoid unexpected sorting.

[1,1000,6,4,1].sort((a, b)=>(a-b)) //ascending
[1,1000,6,4,1].sort((a, b)=>(b-a)) //descending

4. How to get the sum of two number from the function below?

--

--

Ms Chi
Ms Chi

Written by Ms Chi

A typescript JS people who breathes React and Node. Long term learning curve is a must to keep us fresh and competitive. Don’t be overwhelmed by the speed.