// get type of variable
var number = 1
var string = 'hello world'
var dict = {a: 1, b: 2, c: 3}
console.log(typeof number) // number
console.log(typeof string) // string
console.log(typeof dict) // object
Quas; What are the types of variables and what are they?
Ans; Here are the names of some type variables
// number type variable
var myAge = 20;
// string type variable
var myName = "iqbal";
// boolean type variable
var amIsingle = true;
There are two scopes of variables:
- Global variables - Defined anywhere in code
- Local variables - Defined in only function