1
2var a = parseFloat("10")
3var b = parseFloat("10.00")
4var c =
5 parseFloat("10.33")
6var d = parseFloat("34 45 66")
7var e = parseFloat("
8 60 ")
9var f = parseFloat("40 years")
10var g = parseFloat("He was 40")
11
12
1// program to check if a number is a float or integer value
2
3function checkNumber(x) {
4
5 // check if the passed value is a number
6 if(typeof x == 'number' && !isNaN(x)){
7
8 // check if it is integer
9 if (Number.isInteger(x)) {
10 console.log(`${x} is integer.`);
11 }
12 else {
13 console.log(`${x} is a float value.`);
14 }
15
16 } else {
17 console.log(`${x} is not a number`);
18 }
19}
20
21checkNumber('hello');
22checkNumber(44);
23checkNumber(3.4);
24checkNumber(-3.4);
25checkNumber(NaN);
1float is a type of data in coding language , it referes to decimal valu with points like i,e. 100.223 ,3212.546,etc