I am receiving undefined when using charAt[i] #331
Replies: 8 comments
-
Posted at 2014-12-02 by d0773d Using |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-12-02 by Manxome Finally found it! Try data.charAt(i) instead of data.charAt[i], or simply data[i] :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-12-02 by d0773d doh! I used brackets instead of parentheses. Code:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-12-02 by Manxome Two thoughts:
'data' always has a decimal point?
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-12-02 by d0773d No, results don't always have to return in a decimal format, however, in this case they will. I have |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-12-02 by Manxome Doh, I get it now, wasn't reading carefully enough and missed the two I2CI.writeTo()'s before the decimal point check, sorry, my bad! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-12-02 by d0773d If data is 1234 and there is no decimal point in the value, the display will only show 1234. I still have to add checks for how many digits and if the display comma needs to be enabled or not. For example, 25.2'C. I have an idea:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-12-02 by Manxome yeah, sorry, I just realized that and edited my comment, sorry :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-12-01 by d0773d
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?
Beta Was this translation helpful? Give feedback.
All reactions