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