DEV Community

John Au-Yeung
John Au-Yeung

Posted on • Originally published at thewebdev.info

1

How to alert an array with JavaScript?

To alert an array with JavaScript, we convert it to a string before calling alert.

For instance, we write

alert(JSON.stringify(aCustomers));
Enter fullscreen mode Exit fullscreen mode

to call JSON.stringify to convert the aCustomers array to a JSON array string.

Then we call alery with the string to show an alert box with the array string.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more