I have the following code;
var looptijd_1 = de_snelheid * de_afstand;
var split_looptijden_1 = new Array();
split_looptijden_1 = looptijd_1.split('.');
As you can see, is the idea very simple. I want to split an number by its dot. So if the number is 69.07, i want an variable with 69 and an variable with 07.
I know I have to make a string of the variable and split them, but I need the 07 as 07 and not 7 (because I’ve got the do some math with it).
I know that I can take the first value, and store that, then the variable – the stored variable, so I’ve got 0.07, but I hope there’s an better way tho achieve this, because this needs to be done 12 times on the page.
Is there a better way to achieve my goal (variable1 = 69; variable2=07) and both integers?
EDIT;
The whole point, is that this is math about walking time… And there are none constant variables, so i lop them, and then i would like to do the trick (numbers after the dot * 60)
If you’re wanting to perform calculations with the results then there’s no need to convert your number to a string, split it, and then convert the resulting strings back to numbers. Use some basic maths instead: