- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Operators:-
typeof():- The typeof() operator is used to find the type of value.example:-
let a = 10;
let b = 1.5;
console.log(typeof(a));
console.log(typeof(b));
o/p:-
Number
Number
Number
Converting String to a Number:-
In JavaScript, when we combine the number and string, it results in a string.
The parseInt() function accepts a string and converts it into an integer.
example:-
let a = '20';
console.log(typeof(a));
o/p:- string
let b = parseInt(a);
console.log(typeof(b));
let b = parseInt(a);
console.log(typeof(b));
o/p:- number
- Get link
- X
- Other Apps
Comments
Post a Comment