2

I have this array that's logged like so:

enter image description here

How can I "convert" the array to be simpler, so it outputs like this? ["Acura", "Aston Martin", ...]

Thanks!

3
  • 4
    um, that is just how the console shows it. Commented Jul 23, 2020 at 3:06
  • 1
    Yeap, the array does console like you want, but when you console.log it then it will show the index for convince purposes. Use document.write(myArray); if you wanna see for yourself :) Commented Jul 23, 2020 at 3:08
  • It's not an object, it's an array. So, no problem :) Commented Jul 23, 2020 at 3:13

1 Answer 1

1

Instead of this:

console.log(["Acura", "Aston Martin"]);

Do this:

console.log(JSON.stringify(["Acura", "Aston Martin"]));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.