Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 10, 2021 10:45 am GMT

Answer: How to check a not-defined variable in JavaScript

The only way to truly test if a variable is undefined is to do the following. Remember, undefined is an object in JavaScript.

if (typeof someVar === 'undefined') {  // Your variable is undefined}

Some of the other solutions in this thread will lead you to believe a variable


Original Link: https://dev.to/mhsohag11/answer-how-to-check-a-not-defined-variable-in-javascript-2bk2

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To