I'm using unshift to add data to the beginning of an array
x.done(function(data) {
data.unshift({ "data": {
"number": "default",
"description": "Account Default"
} });
});
But it's giving me Uncaught TypeError: data.unshift is not a function
Although, I have used unshift before, and it works fine. I cannot work out what the issue is with this one.
I was also trying to add a second array inside data but this was returning a different error (I think I got the syntax wrong)
data.unshift({ "data": {
"number": "default",
"description": "Account Default"
},
{
"number": "default",
"description": "Account Default"
} });
datais anarray?for(var i in data) {to loop through. it's JSON dataunshiftwith anobject?01234: {data: {…}, seq: "4", customer: "1234", display: "Number 01234", number: "01234", …}sodatais inside another key