+ 7
What is this in JavaScript
console.log(typeof(null); //output object ls this a bug in the language or something,can someone please explain this to me
9 Answers
+ 6
any element in js is object
+ 6
null basically means nothing.
How can we have a datatype to something that doesn't exist?
According to w3 you can consider it a bug in javascript.
+ 4
Cepren I now understand your point of view , what a wow this language is indeed strange some how evil
+ 3
but why , because null do not return anything
+ 3
yeah Toni Isotalo I think you may be right
+ 2
all to inherit from global object Object
null, window, document, Navigator all things have parent Object
0
This might help you. https://stackoverflow.com/questions/18808226/why-is-typeof-null-object
- 2
java scripts is a client site language in which we writes tbe scripts for the validation of the data and dynmicaly update tbe contents
- 3
The variable is blank. This probably means your JS code is running before the HTML loads. Add this around your document to prevent it.
window.onload = function(){
//Your code here
};