I am trying to create an array from another array
let a = ["a", "b", "c", ...]
let b = ["22", "33", "44"]
let desireResult = [
{
"name": "a",
"age": "22"
},
{
"name": "a",
"age": "33"
},
{
"name": "a",
"age": "44"
},
{
"name": "b",
"age": "22"
},
{
"name": "b",
"age": "33"
},
{
"name": "b",
"age": "44"
},
{
"name": "c",
"age": "22"
},
{
"name": "b",
"age": "33"
},
{
"name": "b",
"age": "44"
},
...
]
this is my code:
let profiles = a.map(name=>{
b.map(age=>{
return ({"name": name, "age":age})
})
})
Promise.all([profiles])
but map() has synchronous functionality. so one way is to use Promise.all([]) . but what about map() inside a map()?
Promise.all([])" - This won't change anything. Especially not without a.then(). But this won't do anything useful either when there's nothing to wait for...