![]() |
Javascript: How do I check if a var is null or hasn't been set??
sounds simple doesn't it? this is fucking driving crazy
lets say "myvar" was never mentioned in the code anywhere. the following gives an error message "myvar is undefined" which I want to avoid: Code:
if ( myvar = = undefined ) Code:
if ( myvar = = null ) |
try this:
Code:
if (typeof myvar = = "undefined") { of course, drop the space between = and = :) |
You must nul your var
|
Quote:
|
All times are GMT -7. The time now is 04:19 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123