• I am not sure why I am receiving undefined when I loop through data which is a string, To see if data contained a string I did console.log(typeof data + ": " + data); which echoed out String : 26.19. From my understanding, I thought looping through the data string and using charAt[i] I should in theory return the character at i, however, I am receiving undefined. Why is that and how do I return the character at i?

    s7s.prototype.sendValue = function (data) {
      var a = this.address;
      var length = data.length;
      var i;
      var val;
      var dpLoc;
    
      console.log(typeof data + ": " + data); //echos out a string
    
      for(i=0; i<data.length; i++) {
        var char = data.charAt[i];
    
        console.log(data.charAt[i]);
    
        if(char != ".") {
          val += char;
        }
    
        if(char == ".") {
          dpLoc = i;
        }
      }
    
      //console.log(val);
    
      //I2C2.writeTo(a, value);
    };
    
About

Avatar for d0773d @d0773d started