简体   繁体   中英

iterate over array with JS

I am trying to iterate over an array and based of the value in y: I want to color a point in my chart.

this is what the code i want to use looks like, so index 0 would be {x:1,y:1} (which is why this isnt working now, im guessing). I want to isolate y:1 then color with value === 1

this is my array

$.each(coords, function( index,value ) {
  if(value === 1){
    myColors2[index]="#A39FBB";
$.each(coords, function( index,value ) {
  if(value.y === 1){
    myColors2[index]="#A39FBB";

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