I got the out put which is outputted like clock in seconds,(2:05:5) I want to store it in local storage but converted to anumber like (2055) so that i use that number as setTimeout second parameter after the function .
Like ;
This is my my output
2:05:5
While outputting it I used
Input.val (numbClickedOnce + ‘:’ + secondNumbClicked);
Now i want to remove (’:’) to store t as one numb (2050)
Am using jQuery ,thanks! Have tried to use remove () but throws error of it not being a function in console …tried trim () but actually that is literally for removing white space.
If you want to convert a string into a number.
I would use Number method or parseInt method.
1 Like
That just returns one digit number and its the first one only e.g. I got (2:3:05) it returns
2 and ignores the rest and so does the parseFloat ();
If you want to remove colons as well. You can either
make a regex and match colons and replace them with empty strings or
run a forloop, match colons and replace them with empty strings.
1 Like
Oh sure😊 had forgot about “regrex” thanks let me try and see!
Good luck! Let me know if you get stuck
1 Like
You can also try using .split(":").join("")
1 Like