This is self-reference article for me as I am more & more involved in client side scripting now a days.
Check for undefined
<script> if (customVar === undefined) {customProperties = true;}; </script>
Check for defined
<script> if (customVar !== undefined) {customProperties = true;}; </script>
References