Search code examples
javascriptobjectvar

Is a variable an Object in JS


I'm currently learning JS, and while working on my project, I was wondering if a variable is by definition an object, or a kind of object, or nothing a all.

I know we can create objects through var, but I'm not sure if a var is always an object.

Thanks for the answers !


Solution

  • Variables are not classified as objects. They are their own classification as a storage address. Now as Nina said in the comment, objects are types which are in the same category as: array, string, number, and boolean. A variable can hold any of these types and be referenced to in your code.