do you have idea of what's the most reliable way to check a javascript null?
what does it mean by undefined vs. null in JavaScript? what undefined vs. null?
How found this when i search about "how to check 'null' Value in Java Script?"
if (myVar == null) { alert('myVar is not set.'); }
have you try this?
What?! This isn't why you don't check for equality with null. It's because myVar == null doesn't even remotely do what most people think it does in this context.
A property, when it has no definition, is undefined. Put that way, it's pretty obvious.
'null' is an object. It's type is 'null'. 'undefined' is not an object, it's type is 'undefined'. That part is less obvious.
So people write
if (myVar == null) {
myVar = "Joe";
}
When what they really mean is
if (!myVar) {
myVar = "Joe";
}
this is where i end up with my search... hope you expert guys would help me if i'm wrong.
I am Gayan Belpamulle and this is my web log. This blog includes stuff like my personal details, my photos, my dreams and also some of my nutty works... so, i will be posting my day to day catching to this blog.. enjoy!
Current Status
Actively playing with all possible backend services
23 July, 2009
Subscribe to:
Post Comments (Atom)
Some Popular Posts
-
M.D.K Healthcare Center & Hospital(pvt)Ltd is newly formed private Hospital at Horana with High Tech& High Skilled medical facilit...
-
Javascript: This is a good method taught to me by my friend to disable any character in the keyboard Within Forms in your web page/ web appl...
-
I had this note from long time in my Evernotes, I thought I should have post it here, so someone might find it useful. Why docker? Cont...
No comments:
Post a Comment