10 examples of 'js check if string is number' in JavaScript

Every line of 'js check if string is number' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
13public isNumber(value: any) {
14 return typeof value === 'number' && isFinite(value);
15}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

93function isNumber( object ) {
94
95 return typeof object == 'number';
96}
15function number(value) {
16 return typeof value === 'number' || value instanceof Number;
17}
231function isNumber(object){
232 return typeof object == "number" || _toString.call(object) == "[object Number]"
233}
11function isNumber(value) {
12 return (value instanceof Number) || (typeof value == 'number');
13}
40export function isNumber(num) {
41 return typeof num === 'number' && !Number.isNaN(num);
42}
146export function isNumber(obj) {
147 return !isNaN(parseInt(obj));
148}
27function isNumber(o) {
28 return toString.call(o) == '[object Number]'
29}
17export function isNumber(number) {
18 return typeof number === 'number';
19}
938function isNumber(obj) {
939 var str = Object.prototype.toString.call(obj);
940 return str == '[object Number]' || str == '[object Boolean]';
941}

Related snippets