lib/Check if a Number is Float or Integer.js
// program to check if a number is a float or integer value
program to check if a number is a float or integer value
program to check if a number is a float or integer value
function checkNumber(x) {
    if(typeof x == 'number' && !isNaN(x)){
        if (Number.isInteger(x)) {
            console.log(`${x} is integer.`);
        }
        else {
            console.log(`${x} is a float value.`);
        }
    } else {
        console.log(`${x} is not a number`);
    }
}
function checkNumber ( x ) { if ( typeof x == 'number' && ! isNaN ( x ) ) { if ( Number . isInteger ( x ) ) { console . log ( ` ${ x } ` ) ; } else { console . log ( ` ${ x } ` ) ; } } else { console . log ( ` ${ x } ` ) ; } }
program to check if a number is a float or integer value
program to check if a number is a float or integer value
// check if the passed value is a number // check if it is integer