javascript:array to string in javascript:enclosed with single quotes



array to string in javascript:



var array = ["power","education"];


var string = array.toString();


Result: power,education





array to string in javascript: enclosed with single quotes(' ')







Using ES6 with string interpolation and arrow function.





You can use join() or toString() to display each item separated by a comma





var array = ["power","education"];


console.log(array.map(x=>`'${x}'`).join(','))


console.log(array.map(x=>`'${x}'`).toString());



Result: ' power','education'




Comments

Popular posts from this blog

Android App Version Update using the following cordova cli commands

75 inspirational quotes that will change your life

Retrieval Image From DataBase and Display on WebPage by Using Servlets.