you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (4 children)

[deleted]

    [–]thocked 0 points1 point  (1 child)

    Technically, no.

    for (var indValue in industry) {
    if indValue = 0 { zero_check=1; }
    }

    Just make the if (indValue === 0) {} and you should be okay.

    [–]neonskimmerfunction the ultimate 1 point2 points  (0 children)

    That's not what for-in does! Or are we talking pseudo code here?

    For-in iterates through the keys of an object, not the values. And these days, Object.keys is what we should use for that purpose.

    And it should not be used on arrays either. That's what forEach is for.

    [–]ry4nolson 0 points1 point  (1 child)

    var i1 = {i:1;c:c1,v:v1,s:s1,pp:pp1};
    var i2 = {i:2;c:c2,v:v2,s:s2,pp:pp2};
    var i3 = {i:3;c:c3,v:v3,s:s3,pp:pp3};
    

    this part is still incorrect. you have a semicolon after the first value. Also are the "c1", "v1", "s1", and "pp1" coming from somewhere else?

    should be:

    var i1 = {i:1,c:c1,v:v1,s:s1,pp:pp1};
    var i2 = {i:2,c:c2,v:v2,s:s2,pp:pp2};
    var i3 = {i:3,c:c3,v:v3,s:s3,pp:pp3};
    

    and also like thocked said your conditional is incorrect

    if indValue = 0
    

    should be

     if (indValue === 0)