Js does not recognize "null"

A text= "null" string comes from the front end of

. When using typeof text, it is of type string, but when judging whether it is "null", the result of text== "null" is always false,. How can we tell that it is a "null"?

Apr.03,2021

has been solved. I don't know why both typeof and instanceOf thought it was string, but then it was right to use text==null.


when you add double quotation marks (text= "null"), you already define text as a string. So it must be of the string type.

you can judge whether it is null or not.

if (text = null) {}


because text='null' is a string type; typeof (null) output type is object, and of course false is returned if it is not the same type!

Menu