One trick you should know when working with the"typeof" operator in Javascript
Solomon Iniodu
Remote Telesales & Sales Performance Leader | AWS Cloud Practitioner | Data-Driven Business Growth | Cloud Solutions & Cost Optimization Enthusiast | AI-Powered Sales Strategy
JavaScript has 5 different data types that can contain values:
The "typeof" Operator
You can use the?typeof?operator to find the data type of a JavaScript variable.
Did you know that when a variable is given the value of "null" in javascript, the output turns out as "object"?
See example;
var XYZ = null;
Notice that our output will display as "object" .
document.write(typeof(XYZ));
Output =
object