0
Accessing a character in a string?
I am making a timer. I need to insert a ":" in between minutes and hours. it will look something like this: <input value=456 placeholder="00:00"></input>
6 Answers
+ 8
Suppose the name of your string is s.
Then you can do this:
s.charAt (0)+":"+s.slice (1)
P.s if the first number is less than 10 you need to add a zero before it .
like for input 456 it will be 04:56
+ 9
Ok.
...
... What exactly do you need help with again?? ^_^
+ 8
Joshua Morgan
Only strings have that method.
+ 1
I dont know how to insert colon in middle of hour and minutes.. I have tried finding the lessons but I can't
0
does this work for input integers or only strings? I get the error message "d.charAt is not a function"
0
how can I access char in a line of input values to insert colon? With an array?