Check if the response header is present in javascript, and why string is "null"?

Sorry for what maybe a very dumb javascript question (I'm from cpp/java background) but I can't find an answer to it. I'm writing a little js snippet that needs to check whether response header is present or not. That is how I do it:

Now this part with "null" I feel it is plain wrong. Really, my servlet does not set this header, so it should be null, but not stringly-typed "null". Why do I get "null" instead of null? How to check the response header is empty from ajax response, or check if the string is empty?

EDIT: The thing is, that when I put

var name = xhttp.getResponseHeader("rhrhrhrhers");
if (!name) {...}

the condition (!name) surely doesn't hold, as name is "null", not null. There's no such response header for sure, so there's some hidden type conversion going on under the hood. It is converting the null to "null" when returning the result from getResponseHeader().