I'm trying to log a message to a browser (in my case, Safari) console, and build it up by combining a few strings. But if I include a particular string, which can be logged on its own, I get what kind of looks like an array named "No message", whose contents is the string I'm trying to log.
This code:
var msg1 = ["Outlier!",mName,"for",item[i_v].target,"start",item[i_v].start,"end",item[i_v].end].join(' ');
var msg2 = ["Outlier!",mName,"for",item[i_v].target].join(' ');
console.log(item[i_v].start);
console.log(item[i_v].end);
console.log(msg1);
console.log(msg2);
Produces this in the console:
[Log] 2016-01-27T00:00:00 (index.html, line 674)
[Log] 2016-01-04T18:25:51 (index.html, line 675)
[Log] No message (1) (index.html, line 676)
Outlier! percent_availability for BK.CMB.00.BHZ.M start 2016-01-27T00:00:00 end 2016-01-04T18:25:51
[Log] Outlier! percent_availability for BK.CMB.00.BHZ.M (index.html, line 677)
I have to guess there is something funky about the string in item[i_v].start
(and it is a string, according to typeof
), but have no idea what it might be or what I can do to use it to build a larger string. Any ideas as to how to do so, or even suggestions of what to investigate, would be appreciated.
This is caused by having a timestamp in the string you're logging:
A quick fix is to replace colons with something else:
console.log(msg1.replace(/:/g, ";"))