Answers for "check if field exists in object javascript"

1

javascript if field exists

const hero = {
  name: 'Batman'
};

hero.hasOwnProperty('name');     // => true
hero.hasOwnProperty('realName'); // => false
Posted by: Guest on November-23-2020
0

check if field exists in object javascript

if ('field' in obj) {
}
Posted by: Guest on December-24-2020

Code answers related to "check if field exists in object javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language