* check for undefined and not undefined with != null or == null instead with typeof
* apply review comments by SBoudrias, #542