Checking if a variable exists in JavaScript or TypeScript
That's probably one of the most popular questions that an engineer may ask when learning either JavaScript or TypeScript languages. In some situations, when you don't know if the variable is defined, you may need to check if it exists. That can occur when you are working with objects that were passed into function. Another …