Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript in keyword

const person = { name: 'Nick', lastName: 'Coolguy', yearBorn: 1998 };

console.log('yearBorn' in person); // expected output: true

delete person.yearBorn;
if ('yearBorn' in person === false) {
  person.yearBorn = 2000;
}

console.log(person.yearBorn); // expected output: "2000"
 
PREVIOUS NEXT
Tagged: #javascript #keyword
ADD COMMENT
Topic
Name
4+8 =