I tried to destructure the following array containing URLs with the array of small strings but it’s bringing up an error.
const verses = [
"https://raw.githubusercontent.com/mdn/learning-area/main/javascript/apis/fetching-data/verse1.txt",
"https://raw.githubusercontent.com/mdn/learning-area/main/javascript/apis/fetching-data/verse2.txt",
"https://raw.githubusercontent.com/mdn/learning-area/main/javascript/apis/fetching-data/verse3.txt",
"https://raw.githubusercontent.com/mdn/learning-area/main/javascript/apis/fetching-data/verse4.txt"
]
const ["verse 1", "verse 2", "verse 3", "verse 4"] = verses;
The error says “Uncaught SyntaxError: Invalid destructuring assignment target”. Can anyone tell me why that is? Is the syntax not correct or something?
NOTE: I’m a bit of a novice with JavaScript so forgive me if this might be an obvious problem to solve.