Dynamically Typed Language
- You have two types of programming languages. Statically typed languages or Dynamic typed languages
- In static languages, when you declare a variable, the type of the variable is set and it cannot be changed in the future. Eg C#
- In dynamic languages the type of a variable can change at run time. Eg JavaScript
- Unlike static languages the type of the variables will be determined at runtime based on the values that we assigned to them.
let name = "kumar";
console.log(typeof name);
name = 10;
console.log(typeof name);
let age;
console.log(typeof age);
let carName = null;
console.log(typeof carName);
The typeof
operator returns a string indicating the type of the operand's value.