Having an issue with getting a 2d array using axios in my code. When I try to console.log it, it returns empty. Any suggestions?
Here's the piece of code causing trouble:
let orig = []
axios
.get(<endpoint url here>)
.then(response => {
orig = response.data.activity_history
})
console.log('Orig -> ' + JSON.stringify(orig))
The endpoint is designed to return data structured like this:
{
"id": 1,
...
"activity_history": [
[
"Test",
"Test",
"Test",
"Test",
"Test"
]
]
}
I need to access the 2d array so that I can add another array to it on the frontend. However, the console log for orig
displays as Orig -> []
. Any ideas on how to resolve this?