日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

js isinteger_在JavaScript中使用示例使用Number isInteger()方法

發(fā)布時(shí)間:2023/12/1 javascript 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 js isinteger_在JavaScript中使用示例使用Number isInteger()方法 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

js isinteger

編號(hào)isInteger()方法 (Number isInteger() Method)

isInteger() is a Number Method, it is used to check whether a given number is an integer or not.

isInteger()是一個(gè)數(shù)字方法,用于檢查給定數(shù)字是否為整數(shù)。

It returns true if given number is an integer, if given number is not an integer – it returns false.

如果給定數(shù)字是整數(shù),則返回true;如果給定數(shù)字不是整數(shù),則返回–返回false 。

Syntax:

句法:

Number.isInteger(number);

Examples:

例子:

Input: 10Output: trueInput: 10.23Output: falseInput: "Hello"Output: False

Code:

碼:

<html> <head> <title>JavaScipt Example</title> </head> <body> <script>document.write("10: " + Number.isInteger(10) + "<br>");document.write("10.23: " + Number.isInteger(10.23) + "<br>");document.write("Hello: " + Number.isInteger("Hello") + "<br>");//checking with variablesvar a = 10;var b = 10.23;var c = "Hello";if(Number.isInteger(a)==true)document.write(a + " is an integer value" + "<br>");elsedocument.write(a + " is not an integer value" + "<br>");if(Number.isInteger(b)==true)document.write(b + " is an integer value" + "<br>");elsedocument.write(b + " is not an integer value" + "<br>");if(Number.isInteger(c)==true)document.write(c + " is an integer value" + "<br>");elsedocument.write(c + " is not an integer value" + "<br>"); </script> </body> </html>

Output

輸出量

10: true 10.23: false Hello: false 10 is an integer value 10.23 is not an integer value Hello is not an integer value

翻譯自: https://www.includehelp.com/code-snippets/number-isInteger-method-with-example-in-javascript.aspx

js isinteger

總結(jié)

以上是生活随笔為你收集整理的js isinteger_在JavaScript中使用示例使用Number isInteger()方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。