Click here to Skip to main content
15,069,133 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i Have Array Like

JavaScript
Var arr=[];

arr.push(1)
arr.push(2)
arr.pus(3)


I want the output like


JavaScript
var output=["1","2","3"]


What I have tried:

var output= arr.map(item => "'" + item + "'").join();
JavaScript

Posted
Updated 15-Sep-21 22:07pm
v3

1 solution

JavaScript
const input = [1, 2, 3];
const output = input.map(i => i.toString());
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900