Quantcast
Channel: Active questions tagged questions - Meta Stack Overflow
Viewing all articles
Browse latest Browse all 597

Popular JS-related question asks contradictory things in title and body

$
0
0

Consider this question:

How to check for an undefined or null variable in JavaScript?

The title seems pretty straightforward, but the body of the question asks for a less verbose form for the following check:

if (typeof(some_variable) != 'undefined'&& some_variable != null)

this is a check for an undeclared or nullish variable.

The question has several answers, some/all of which discuss checking for undefined, rather than undeclared variables. These checks trigger an exception if used for declared variable.

Assuming I am not misreading/misunderstanding - what should be done in this situation? Should I re-title, or change the body, after so much activity on that question? And if you say "no" - we can't just leave it the way that it is, can way? It's confusing and misleading for people, especially JS novices.


Viewing all articles
Browse latest Browse all 597

Trending Articles