javascript isset equivalent

i was just looking for an equivalent to the isset in php for javascript, i was initially using .length but this can still cause errors so i found this solution.
if (typeof my_var !== 'undefined') {}


var my_var = "something";
if (typeof my_var !== 'undefined') {
var note = 'do something if my variable exists and has something in it';
if (typeof not_my_var !== 'undefined') {
var note = 'this should not run or cause errors unless not_my_var has a value even though it it not declaired anywhere';

Other Items in javascript
Page Views

This page has been viewed 91 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
Treasure every moment that you have and treasure it more because you shared it with someone special, special enough to spend your time...and remember that time waits for no one.