Check if a javascript variable is defined

if (typeof variable === 'undefined') {
	// variable is undefined
}