So I'm working on dividing the width of a display and this results in not so clean numbers.
My current solution is to drop the right side and use it as padding for generating the tiles.
So for example, if I get the number 336.75
(1366 monitor minus scroll bar divided by 4)
I split it using the split method after having converted the number to a string.
The problem is I can't get the right side to have a decimal again.
Using:
var testNumber = 336.75,
numString = testNumber.toString(),
numParts = numString.split('.'),
numLeft = numParts[0],
numRight = numParts[1];
If I try to bridge the right side back to a decimal like this:
var newNum = parseInt('.'+numRight);
I get a NaN result.
I want to get that 0.75
number and use it as padding.
Right now it's as if .75
is the number 75
due to the lack of a missing decimal point.
parseFloat seems to work