I seem to be using this test a lot
if( object && object !== "null" && object !== "undefined" ){
doSomething();
}
on objects I get back from a service call or from reading cookies (since different browsers return the different values null, undefined, "null", or "undefined").
Is there an easier/more efficient way of doing this check?
"null"and"undefined", then your method can't be any simpler."null"or"undefined". Thanks for the confirmation.!!likeif(!!myobj){doSomething();}to check the object. It converts the object to boolean and then inverts it again. Look at this answer for a very good explanation .