06-16-2018 18:47
06-16-2018 18:47
Hello all (again!),
I have a function that receives a couple of arguments, then uses those arguments.The function has no problem receiving the correct info, but when I use the one for color, the function fails. Any thoughts?
function mainClock(loadColor, loadZone) { let today = new Date(); let hours = today.getHours(); let mins = util.zeroPad(today.getMinutes()); let myAMPM; let timeZone = util.stripQuotes(loadZone); console.log(`loadColor <${loadColor}>`); time1.style.fill = loadColor; ampm.style.fill = loadColor; myTZ.style.fill = loadColor; myTZ.text = timeZone;
The console.log shows the proper color "red", "blue" quotes and all, however Iget error messages that terminate with the loadColor (I can post more of the code, if it helps). If I replace loadColor with "red" or "blue", everything works. I have tried = JSON.stringify(loadColor) with no change in results. The timeZone works like a champ. What am I missing?
Answered! Go to the Best Answer.
06-16-2018 19:38
06-16-2018 19:38
I wonder about 'quotes and all'. I suspect that the value you should be assigning should be something like
red
and not
"red"
06-16-2018 19:38
06-16-2018 19:38
I wonder about 'quotes and all'. I suspect that the value you should be assigning should be something like
red
and not
"red"
06-16-2018 20:51
06-16-2018 20:51
That did it. I stripped the quotes off inside the variable and it is now working.
Thanks!