I would suggest using '=== undefined'  to check if something is undefined. It is the standard way we use in three.js.

https://github.com/mrdoob/three.js/search?q=%3D%3D%3D+undefined&ref=cmdform