jquery - Formatting strings in Javascript - Translating function from python to javascript -
how format strings in javascript? wrote python code , i'm trying translate javascript i'm not sure how
python code:
def conv(t): return '%02d:%02d:%02d.%03d' % ( t / 1000 / 60 / 60, t / 1000 / 60 % 60, t / 1000 % 60 + 12, t % 1000)
does javascript/jquery let similar this? , if so, how?
thanks!
what you're referring printf
/ string.format
-like operation. unfortunately, javascript not have built-in way of doing (which bad, really).
there are, of course, many libraries give kind of functionality.
here's 1 of them (sprintf) follows printf
syntax, , here's one uses format
syntax.
Comments
Post a Comment