Example 1 — Example
Typical use.
JavaScript
const a = [1, 2];
console.log(a.constructor === Array);
console.log(a.constructor.name);How It Works
- constructor. Same as Array.
- name. "Array".
An array's constructor property points at the Array function that created it.
const a = [1, 2];
console.log(a.constructor === Array);
console.log(a.constructor.name);Typical use.
const a = [1, 2];
console.log(a.constructor === Array);
console.log(a.constructor.name);CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful