I was trying to divide a variable with type "UNDEFINED" and other variable with type "OBJECT" and I was storing the value of the division in the third parameter and when i was checking the type for the third parameter it was showing number.
So can somebody explain me the problem.
<html> <head> HELLO!!! <script> var a; var b = null; var c = a / b; console.log(typeof a); console.log(typeof b); console.log(typeof c); </script> <body> </body> </head>
NULL is considered as
+0 in js if you divide
0 then you will get
NaN which is type of
You are dividing
null so you are getting
Finally your expression will be
c = undefined/0; //It will return NaN
You can check if result is
NaN which type is
var a; var b = null; var c = a / b; console.log(typeof a); console.log(typeof b); console.log(typeof c); console.log(Number.isNaN(c));