Subj : Question about string.trim()
To : All
From : KenDB3
Date : Thu Sep 08 2016 10:11 am
Hi there folks,
So, I've been running the Solar Data app for a little while and have not run
into this, but now that I put it out there for a wider audience, I seem to have
encountered an issue.
Someone reported this error message to me:
9/7 11:14:09p Node 1 !javascript c:\sbbs\xtrn\solar\alco-solar.js line 275:
typeError: sfi.trim is not a function
So, my first question is, is the trim() function valid in JavaScript 1.8.5? I'm
guessing it is because it's been working in this app thus far, but maybe this
is the first time something actually needed to be trimmed?
What I find interesting is that the error flagged on a trim() on line 275, but
was OK with the trim() on line 270: timestamp.trim().
The code can be found here:
https://github.com/KenDB3/alco-solar-JS/blob/master/alco-solar.js
If trim() is valid, then am I...
1) Doing something wrong?
2) Using it incorrectly?
3) Not doing a good job of dealing with it if it is undefined? (lines 81-84)
4) Gone plumb crazy (crazier than normal, I guess)?
My third question stood out to me because it is the only one that turns into an
Integer (0) if it is undefined, where the other ones turn into Strings ("No
Data").
~KenDB3