Check if character is number?

前端 未结 22 774
误落风尘
误落风尘 2020-12-03 00:29

I need to check whether justPrices[i].substr(commapos+2,1).

The string is something like: \"blabla,120\"

In this case it would check whether \'0

22条回答
  •  感情败类
    2020-12-03 00:48

    function is_numeric(mixed_var) {
        return (typeof(mixed_var) === 'number' || typeof(mixed_var) === 'string') &&
            mixed_var !== '' && !isNaN(mixed_var);
    }
    

    Source code

提交回复
热议问题