Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 650 Bytes

2015-01-6-not-everything-in-js-is-object.md

File metadata and controls

18 lines (16 loc) · 650 Bytes
layout title subtitle bigimg
post
Not everything in JavaScript is an object, how?
Everything in JavaScript is or act like an object
/img/start.jpg

Not everything in JavaScript is an object, how?

Most of the time we have heard that everything in JS is an object which is not true. Let me prove it through an example.

 var name = "jitendra";
 name.hi = "hi";
 console.log(name.hi);
 //it will print undefined

It means we are not allowed to add property "hi" on literal name. If it was an object we should have been able to add the properties on that object. Therefore, everything cannot be an object in JavaScript.