Check if variable exist

How can I check if variable exist?
I tried:

if (global.get("NAME")===undefined)

If you want to check something exists, they you need to check it does not equal undefined. You are current checking to see if it does equal undefined.

if (global.get("NAME")!==undefined)

If that doesn't give you what you expect then add a line

node.warn(`NAME is ${global.get("NAME")}`)

to find out what it actually is.