How to get the data type of a variable in TypeScript

1 Answer

0 votes
console.log(typeof "typescript")
console.log(typeof ("typescript" + "pro"))
console.log(typeof 90.3784)
console.log(typeof 351)
console.log(typeof (8 + 19))
console.log(typeof true)
console.log(typeof false)
console.log(typeof 102345n)

let x

console.log(typeof x)



/*
run:

string
string
number
number
number
boolean
boolean
bigint
undefined

*/

 



answered Nov 8, 2024 by avibootz

Related questions

1 answer 173 views
1 answer 147 views
1 answer 158 views
1 answer 147 views
1 answer 121 views
1 answer 194 views
1 answer 107 views
...