I can't find anything that explains clearly what is wrong and what I should do.
I have this array:
const pages = [
{
url: "/",
page: 'pages/home.html',
title: "Home" },
{
url: "/recordings",
page:'pages/recordings.html',
title: "Recordings" },
{
url: "/editions",
page: 'pages/editions.html',
title: "Editions" },
{
url: "/videos",
page: 'pages/videos.html',
title: "Videos" },
]
I'm trying to loop it through with a for loop. page.url returns "undefined" in the console. But the "Test URL" console log returns a url string as expected. Why? What do I do? I want the page.url in the foor loop.
console.log("Pages: " + pages)
console.log("Test URL: " + pages[1].url)
for (page in pages) {
console.log("Page: " + page)
console.log("Page URL: " + page.url)
}