본문 바로가기

Web/Javascript

[JAVASCRIPT] isNaN 검사

isNaN

  • NaN 타입 확인시 사용하는 메소드
  • typeof 로는 number 로 리턴됨
isNaN(NaN) // true
isNaN(parseFloat("geoff")) // true
typeof NaN // 'number'

Reference

 

How do you check that a number is NaN in JavaScript?

I’ve only been trying it in Firefox’s JavaScript console, but neither of the following statements return true: parseFloat('geoff') == NaN; parseFloat('geoff') == Number.NaN;

stackoverflow.com

 


There might be incorrect information or outdated content.

'Web > Javascript' 카테고리의 다른 글

[JAVASCRIPT] this  (0) 2023.08.25
[JAVASCRIPT] try-catch 에러 전파  (0) 2023.08.15
[JAVASCRIPT] DOM - 노드 조작  (0) 2023.08.04
[JAVASCRIPT] DOM - 노드 탐색  (0) 2023.08.04
[JAVASCRIPT] DOM - 노드 취득 (HTMLCollection)  (0) 2023.08.04