+ 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

29th Aug 2018, 5:33 PM
George S Mulbah II
George S Mulbah II - avatar
9 Answers
+ 6
any element in js is object
29th Aug 2018, 5:37 PM
Сергей Луньков
Сергей Луньков - avatar
+ 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.
29th Aug 2018, 6:19 PM
Toni Isotalo
Toni Isotalo - avatar
+ 4
Cepren I now understand your point of view , what a wow this language is indeed strange some how evil
29th Aug 2018, 6:36 PM
George S Mulbah II
George S Mulbah II - avatar
+ 3
but why , because null do not return anything
29th Aug 2018, 6:09 PM
George S Mulbah II
George S Mulbah II - avatar
+ 3
yeah Toni Isotalo I think you may be right
29th Aug 2018, 6:27 PM
George S Mulbah II
George S Mulbah II - avatar
+ 2
all to inherit from global object Object null, window, document, Navigator all things have parent Object
29th Aug 2018, 6:32 PM
Сергей Луньков
Сергей Луньков - avatar
29th Aug 2018, 10:54 PM
Dilan Livera
Dilan Livera - avatar
- 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
30th Aug 2018, 3:39 AM
Malik Honey
Malik Honey - avatar
- 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 };
29th Aug 2018, 9:14 PM
James
James - avatar