Conditional checking for uninitailized, undefined variable in javascript

If you’re working in php, its very simple to check a variable if it is initailized or has a value but in javascript, its a bit tricky if you didn’t handle this yet. But if you’re a javascript guy, it might be supper simple for you. Anyway, I’m sharing here the way I did to check an undefined variable in javascript. Just try following code –

if (typeof myVar == 'undefined')

I thought, sharing this will be helpful to others. Thanks!