Delete object property, change length?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryura

    Delete object property, change length?

    Hello,
    I'm currently getting some JSON data (y.x) and then doing something
    like this:
    $("dd.tajauser" ).each(function () { // does the function for each
    dd.tajauser
    var z=y.x.length;
    z-=1;
    do {
    if (y.x[z].a == b) {
    c[d]+=parseInt(y.x[z].e);
    delete y.x[z];
    };
    }
    while (z--);
    });
    My problem is this: delete doesn't affect y.x.length, so when my each
    function attempts to check the second dd.tajauser, I get thrown this
    error
    y.x[z] has no properties

    How can I delete y.x[z] and modify the length of y.x at the same time?
    Thanks.
  • VK

    #2
    Re: Delete object property, change length?

    On Jan 24, 2:03 am, Ryura <yoyobo...@gmai l.comwrote:
    How can I delete y.x[z] and modify the length of y.x at the same time?
    The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.



    Comment

    Working...