How do I remove a string from anumber?

How do I remove a string from anumber?
0

#1

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.


#2

If you want to convert a string into a number.

I would use Number method or parseInt method.



#3

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 ();


#4

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.


#5

Oh sure😊 had forgot about “regrex” thanks let me try and see!


#6

Good luck! Let me know if you get stuck :slight_smile:


#7

You can also try using .split(":").join("")