bhylu.com

Advertisements

JS 2022

Array.at accepts negative indexes to count from the end. Object.hasOwn offers a direct own-property check.

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 tools = ["Brush", "Tape"];
console.log(tools.at(-1));
console.log(Object.hasOwn({places: 12}, "places"));

What happens

The results are Tape and true.