Hey there! I need help with the following code snippet:
let names = ["josh", "tony", "daniel"];
let arrayplaces = ["30", "60", "90"];
names.forEach((elem, indexed) => {
const num2 = arrayplaces[indexed];
console.log('The user ' + elem + ' iterated in place ' + num2);
});
I'm trying to iterate through each element of the first array and pair it with each element of the second array sequentially. The goal is to output all possible combinations.
Expected Output Example:
The user josh iterated in place 30
The user tony iterated in place 30
The user daniel iterated in place 30
The user josh iterated in place 60
The user tony iterated in place 60
The user daniel iterated in place 60
The user josh iterated in place 90
The user tony iterated in place 90
The user daniel iterated in place 90
If you have any idea on how to achieve this, please let me know!