Here is a part of the function I'm working on:
this.instructions is an array.
I've deliberately added some console.log() just to show you that the item I'm looking for in this.instructions array exists.
insertOrUpdateI(i, instruction_frame) {
    if (i.hasOwnProperty('src_id')) {
      let iToUpdateIndex = this.instructions.findIndex(known_i => known_i.src_id == i.src_id);
      console.log('i: ',i)
      console.log('this.instructions: ',this.instructions);
      console.log('iToUpdateIndex: ', iToUpdateIndex);
      if (iToUpdateIndex > -1) {
        let oldInstruction = this.instructions[iToUpdateIndex];
        this.instructions[iToUpdateIndex] = {...i, frame: oldInstruction.frame}; // don't update the frame
        this.reconstructMatchState({
          fetchFromBack: false,
          lastFrame: this.stream.lastCameraFrame,
          applyNow: true
        }).subscribe();
        return
      }
    }
....
Here is the result I get:
i : {subject: "card", player_id: 6547, card_type: "yellow_card", src_id: 1, frame: 5077}
this.instructions: [{subject: "period", name: "period_1", start: 5031, frame: 5031, src_id: -1}, {subject: "card", player_id: 6547, card_type: "yellow_card", src_id: 1, frame: 5077}]
iToUpdateInde: -1
However, I have i.src_id === 1 and there is an item on my array that has a src_id == 1
What am I missing? I would appreciate some help!
 
     
    