I was curious how I'll be able to return two arrays within a function. For example lets say we got an array of countries and a list of todo.
var countries = [
"Japan",
"USA"
]
var todo = [
"go to the park",
"drink amazing whiskey"
]
The way I wish the answer to come out is after it's looped we'll see
"Japan I will go to the park"
"USA I will drink amazing whiskey"
The way I wrote my function at the moment was:
function myTrip(countries, todo){
var newArr = [];
for (var i = 0; i < countries.length; i++) {
newArr += countries[i]
}
for (var i = 0; i < todo.length; i++) {
newArr += todo[i]
}
return newArr
}
I honestly don't know where to go from here. I understand I need to put them in an array such as countries[i] + " I will " + todo[i] but I'm uncertain how to do that. Would I need to do return instead of newArr =+ countries[i]? or am I completely wrong in my logic and in my code? all help in this would be appreciated.