Bagaimana cara memeriksa apakah ada objek dalam javascript
if (typeof maybeObject != "undefined") {
alert("GOT THERE");
}
Smiling Stoat
if (typeof maybeObject != "undefined") {
alert("GOT THERE");
}
let result = person.hasOwnProperty('firstName');
console.log(result); // true
Code language: JavaScript (javascript)