-
• #2
I think
Object.keys
will do you:Object.keys(replaceList).forEach(e => { timeN = timeN.replace(e,replaceList[e]); });
-
• #3
Thanks, it works
console.log(timeN);
('0'+d.getHours()).substr(-2):('0'+d.getMinutes()).substr(-2):('0'+d.getSeconds()).substr(-2) -
• #4
Quite interesting... this logic pulls it of 'the other way round'... which may become a performance challenge when the replaceList being larger and larger compared to the pattern elements...
-
• #5
which may become a performance challenge
It'll definitely get slower, however in this case we're actually doing the work on the PC before upload to the Bangle.js, so I don't think it'll be that big a deal for us. On Bangle.js itself this could be a complete pain though.
-
• #6
Ic... it is a one-time-thing of composing/generating the code before uploading it... as source?
-
• #7
That's the idea :)
How to write this correct?