This may seem like an easy question, but im stuck. Currently, I am passing an object over to my function, which in return is supposed to push an object's value to an array. As of now its not pushing INTO the array and it coming back as a count 0 and undefined if I try to get at the actual value explicitly.
In my check file, i have a function call with a forloop that sends the object and the count
for (let i=0; i< data.length; i++){
addtoList(i, data);
}
});
the forloop is looping through data returned from a Django object as such
data = serialize("json", modelname.filter(username=...))
return HttpResponse(data)
In my addto file, the actual function should handle adding the object to the list.
var pushere = []
function addToList(i,data){
pushere.push(data[i].fields.title)
console.log(data[i].fields.title)
};
console.log(pushere)
now i also logged a regular list to see the differences
const testListt = ['a','b','v']
console.log(testListt)
with that being said, how am i supposed to properly 'push' object values to an array, which is what i am needing before displaying it to the page. I've tried mapping objects with help from Mozilla Map and their help on Objects.
When a user first logs in, it seems to work, but upon a page refresh i am not able to get at the value.
*first login
Would saving it into the localstorage and getting the value from there work instead?