Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

compare NaN in javascript if condititon

// Use isNaN() 
// In javascript compare NaN direct alweys return false
let num1 = Number("Vishal");

// This code never work
if(num1 == NaN){  // Direct compare NaN alweys return false so use isNaN() function
  ....... Your Code .......
}  

// This code work
if(isNaN(num1){
  .........Your Code .......
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: set date input html using js 
Javascript :: detect dark mode javascript 
Javascript :: bootstrap cdn for react 
Javascript :: async storage has been extracted from react-native core 
Javascript :: array methods javascript 
Javascript :: how to calculate distance between two points in javascript 
Javascript :: add variables in javascript 
Javascript :: passing data variable using ajax 
Javascript :: javascript radio button onchange 
Javascript :: how to print line break in javascript 
Javascript :: how to test usestate in jest 
Javascript :: loopback model count 
Javascript :: async await catch error 
Javascript :: tailwind modal react 
Javascript :: canvas umu 
Javascript :: js check if dom element exists 
Javascript :: flatlist react native 
Javascript :: check if string is datestring javascript 
Javascript :: how to import background image in inline css in react 
Javascript :: how to sum two var in jquery 
Javascript :: array contains multiple js 
Javascript :: react native zindex issue on android 
Javascript :: remove a specific element from an array 
Javascript :: how to numeric value is after point 2 values in javascript 
Javascript :: jquery remove attribute 
Javascript :: what is the use of angularjs 
Javascript :: isarray 
Javascript :: a href javascript void 
Javascript :: prop type for ref in react js 
Javascript :: add zero in front of numbers javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =