1.

Explain the purpose of the ‘in’ operator.

Answer»

The in operator is used to find if a PROPERTY is in the specified object. It RETURNS true if the property belongs to the object. OTHERWISE, it returns false.

const CAR = { make: 'Hyundai', model: 'Elantra', year: 2017 };console.log('model' in car); // trueconsole.log('test' in car); // false


Discussion

No Comment Found