DEV Community

Prasham Ashesh
Prasham Ashesh

Posted on

1

Weird Javascript?

const a = [1]
a[3] = 3
console.log(a.length);

//What do you expect the output to be?

Top comments (1)

Collapse
 
pracoon profile image
Prasham Ashesh

Answer: 4

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay