This code works as intended based on the problem I am supposed to solve. However, as I am new to JavaScript, I was curious if this is the proper way to handle zipping two arrays. I've already read a few examples using map which seem concise, but I am more curious if there is a generally agreed upon proper method in JavaScript to do this?
var faker = require("faker");
var products = Array.from({length:10}, () => faker.commerce.productName());
var prices = Array.from({length:10}, () => faker.commerce.price())
var strOut = "";
for(var i=0; i<10; i++){
strOut += `${products[i]} - ${prices[i]} \n`
}
console.log('====================\n'+
'WELCOME TO MY SHOP!\n'+
'====================\n'+
`${strOut}`);
{ "product" : "some product", "price" : 5.99 }is a better structure.