If, for instance, I were to have two arrays within JavaScript. The initial one possessing titles
var titles = [ "welcome page", "how it works", "about us"]
And the subsequent array containing the respective links to those pages
var links = [ "/home", "/howitworks", "/about"]
The aim is to generate a json object utilizing keys "title" and "link" from the aforementioned arrays as illustrated below:
source:{
{
title:"welcome page",
link:"/home"
},
{
title:"how it works",
link:"/howitworks"
},
...
}
Is there anyone that could provide guidance on how to achieve this?