bhylu.com

Advertisements

Object Reference

Use Object.hasOwn, keys, values, and entries for different inspection jobs. Choose the one that matches the question.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

const session = {title: "Repair club", places: 12};
console.log(Object.hasOwn(session, "places"));
console.log(Object.values(session));

What happens

The property exists and the values are returned as an array.