diff options
Diffstat (limited to 'html')
-rw-r--r-- | html/ecmascript-isfinite.html | 37 | ||||
-rw-r--r-- | html/ecmascript-isinteger.html | 36 |
2 files changed, 73 insertions, 0 deletions
diff --git a/html/ecmascript-isfinite.html b/html/ecmascript-isfinite.html new file mode 100644 index 0000000..6941c5d --- /dev/null +++ b/html/ecmascript-isfinite.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> +<head> +<title>test ecmascript Number.isFinite()</title> +</head> +<body> +<h1>test ecmascript Number.isFinite()</h1> + +<noscript><p>Javascript is disabled</p></noscript> +<script> + function div(x) { + if (Number.isFinite(1000 / x)) { + return 'NO'; + } + + return 'YES'; + } + function gdiv(x) { + if (isFinite(1000 / x)) { + return 'NO'; + } + + return 'YES'; + } + document.write("<p>"); + try { + document.write(div(0), div(1)); + document.write(gdiv(0), gdiv(1)); + } catch (e) { + document.write(e); + } + document.write("</p>"); + +</script> + +</body> +</html> diff --git a/html/ecmascript-isinteger.html b/html/ecmascript-isinteger.html new file mode 100644 index 0000000..0ca417f --- /dev/null +++ b/html/ecmascript-isinteger.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> +<head> +<title>test ecmascript Number.isInteger()</title> +</head> +<body> +<h1>test ecmascript Number.isInteger()</h1> + +<noscript><p>Javascript is disabled</p></noscript> +<script> + function fits(x, y) { + if (Number.isInteger(y / x)) { + return 'YES'; + } + return 'NO'; + } + function gfits(x, y) { + if (isInteger(y / x)) { + return 'YES'; + } + return 'NO'; + } + + document.write("<p>"); + try { + document.write(fits(5, 10), fits(5, 11)); + document.write(gfits(5, 10), gfits(5, 11)); + } catch (e) { + document.write(e); + } + document.write("</p>"); + +</script> + +</body> +</html> |