DEV Community 👩‍💻👨‍💻

John Au-Yeung
John Au-Yeung

Posted on • Originally published at thewebdev.info

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)

Make Your Github Profile Stand Out

Github is great, but have you considered how to make yours more attractive for potential employers or other visitors? Even non-tech ones like recruiters!

Take a couple of hours and show your best side as a person - and a programmer.