Reputation: 117
I'm trying to remove the printed single quotations which occur while running the following code.
I've tried playing around with the replace(/['"]+/g, ''
but I'm not getting this correctly.
var arr = ["Alpha", "Omega", "Delta"];
var symbol = "weee";
for(x=0; x<arr.length; x++){
console.log(x,symbol,arr[x]);
}
This returns:
0 'weee' 'Alpha'
1 'weee' 'Omega'
2 'weee' 'Delta'
Upvotes: 4
Views: 3126
Reputation: 1232
If the types of console.log
parameters are different, string type will be marked by quotation marks, so you can make the parameters to a single string, just like:
console.log(x + ' ' + symbol + ' ' +arr[x]);
Upvotes: 7