During some projects I have needed to validate some data and be as certain as possible that it is javascript numerical value that can be used in mathematical operations.
function isNumber(value){
return !isNaN(parseFloat(value)) &&
isFinite(value.toString().replace(/^-/, '')) &&
typeof value !== 'object';
}
or :
function isNumber(value){
return !Array.isArray(value) && !isNaN(parseFloat(value)) &&
isFinite(value.toString().replace(/^-/, '')) &&
Object.prototype.toString.call(value) !== '[object Object]';
}