var hello = 'null';
How do I remove the quotes so var hello will truly equal null (and not a string)? I'm curious on how to do this without using JSON.parse.
You could eval or parse it from JSON (but eval is a terrible approach, I only mention it for the sake of this specific example). Like,
var hello = JSON.parse('null');
console.log(hello === null);
eval for this is a sure-fire way to a disaster later on. Your answer should list the caveats of such an approach, if you're suggesting it.
var hello = null;? Or do something like:var hello = 'null'; var bar = hello === 'null' ? null : hello;?'null'is a string. It doesn't have any quotes, you can't remove them. How did you get this value? Further, what's wrong withJSON.parse?