简体   繁体   中英

Javascript modify array objects property?

So I have an array, where I am trying to update an objects property value, like so:

        this.tasks[5].status = "complete";

   // Here is the object looks like when I log it:
    {"rowID":16,"task":"and more stuff","status":"incomplete","inlist":"Homework"}

Yet the above code does not change the value, it does nothing. Is my syntax wrong, or is there something else in my code causing this?

It seems I can add properties to the object, but I cant modify existing ones. I also can delete the object, but cant delete a property from it.

Thanks

It must be something else in your code. Here are two pics of your setup working in both Chrome and IE9.

Chrome Console

IE9 Console

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM