...

View Full Version : Null check not working



WindInFace
03-05-2010, 06:56 PM
Hi All,

This code returns "result: unknown". A successful check for null should return "result: isNull".

Suggestions?



var myValue = null;
var myResult = "unknown";
if (myValue == null) {
myResult == "isNull";
};
alert("value: " + myValue
+ "\nresult: " + myResult
);

Philip M
03-05-2010, 07:04 PM
myResult == "isNull";

== is comparison
= is assignment.

So myResult = "isNull";


In last month's article about beer and the many breweries in Belgium, 'rapist monks' should have read 'Trappist monks'. - Woking Review

WindInFace
03-05-2010, 07:07 PM
doh!

Thanks Philip!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum