Skip to content

Instantly share code, notes, and snippets.

View wilca's full-sized avatar
🏠
Working from home

wilmar campo wilca

🏠
Working from home
View GitHub Profile
@devudit
devudit / isset.js
Last active December 7, 2024 05:36
JavaScript isset() equivalent
// I generally use the typeof operator:
if (typeof obj.foo !== 'undefined') {
// your code here
}
// It will return "undefined" either if the property doesn't exist or its value is undefined.
// There are other ways to figure out if a property exists on an object, like the hasOwnProperty method: