Hey I'm pretty new to coding. I've tried looking around for how to do this but am at a loss.
Below are the two functions, which are in an object.
listPeople: function () {
let array = []
return array;
// returns an array of all people for whom tasks exist
},
add: function ( name, task ) {
return this.listPeople().push( name )
},
If I run this, the add function returns 1. and will return 2 if I push two things in, and so on. What's going on here, how do i push the name variable from add into the array in listpeople?? The name variable is 'zeke' by the way.
Sorry in advance if this doesn't make sense :D
if this doesn't make sensevery true, It doesn't make sense... Please be clear and specific what exactly do you want and You should add minimal reproducible code, so that people can understand your problem clearly.listPeople, you’re creating a new array, which then goes nowhere because it isn’t saved anywhere.