1// Use isNaN()
2// In javascript compare NaN direct alweys return false
3let num1 = Number("Vishal");
4
5// This code never work
6if(num1 == NaN){ // Direct compare NaN alweys return false so use isNaN() function
7 ....... Your Code .......
8}
9
10// This code work
11if(isNaN(num1){
12 .........Your Code .......
13}
14