当前位置:网站首页>Differences between IsNaN and number.isnan in JS
Differences between IsNaN and number.isnan in JS
2022-07-27 05:41:00 【weixin_ forty-six million fifty-one thousand two hundred and si】
1)isNaN
- In order to judge whether the value of a calculation result or variable NaN
- isNaN(value):value Indicates the detected value
- The judgment process : First, type detection , If the parameter passed in is not of numeric type , The second step is to convert the passed in parameter to numeric type , Then whether it is NaN The judgment of the
console.log(isNaN(NaN));//true
console.log(isNaN(true));//false
console.log(isNaN('aaa'));//true
console.log(isNaN(null));//false
console.log(isNaN(''));//false
console.log(isNaN(undefined));//true
2)Number.isNaN The process of judgment : First, type detection , If the parameter passed in is not of numeric type , Go straight back to false If the judgment is numeric , And then use isNaN Judge in a way
console.log(Number.isNaN(NaN));//true
console.log(Number.isNaN(true));//false
console.log(Number.isNaN('aaa'));//false
console.log(Number.isNaN(null));//false
console.log(Number.isNaN(123));//false
console.log(Number.isNaN(undefined));//false
边栏推荐
- Gallerycms download, installation and configuration
- 弹性盒/伸缩盒(flex)的使用
- Maintain login and route jump
- Permission display - dynamic list on the left
- 攻防世界-lottery
- XSS知识点
- 初识C语言——常见的数据类型
- 程序环境和预处理(下):#define、#undef、命令行编译、条件编译、文件包含(超全整理,建议收藏!!!
- Introduction to C language pointer
- Program environment and preprocessing (Part 2): define, undef, command line compilation, conditional compilation, file inclusion (super full collation, recommended collection!!!
猜你喜欢

一本通1329 细胞(广度优先搜索)

权限展示-左侧列表动态化

First knowledge of C language -- common data types

初识C语言——常见的数据类型

First knowledge of C language - why does every C program have a main function

正则表达式

元素显示模式:块级,行内,行内块,嵌套规范,显示模式转换

First knowledge of C language -- constants and variables

程序环境和预处理(上):一个程序是怎么成功运行的?

Permission display - dynamic list on the left
随机推荐
C语言进制转换以及原补反码位运算介绍
Share a multiple-choice question about variables (including global variables, local variables, the scope of variables, and life cycle knowledge points)
初识C语言——字符串+转义字符+注释
Introduction to C language functions
「PHP基础知识」定界符的使用
页面的配置
C语言中堆内存介绍和管理
Introduction of C language base conversion and original complement inverse code point operation
arguments
C language string function: StrCmp, strncpy, strncat, strncmp, strstr, strtok, strError
Sharing force buckle-189. Three solutions of rotation array
[MRCTF2020]PYWebsite 1
「PHP基础知识」PHP中实现数学运算
Qsort - the sorting function in C language (with void*, callback function knowledge points
SQL (MySQL) rookie tutorial knowledge
背景图片相关应用-铺满,自适应
Self understanding and thinking
「PHP基础知识」PHP语句和语句块
Project login and registration ideas
cmd命令和npm命令