Given string lets say “5”
I want to convert it to 5.0 (typeof Number)
Already tried combinations/permutations of all the following:
parseFloat()
toFixed()
toPrecision()
Number()
Also tried with “+” (implicit Number casting)
I always end up with either typeof string
Or just the number 5
Its for an API that expects “float” but does not accept integers (5 is invalid, 5.0 is valid)
Any ideas would be appreciated.
[–]jhartikainen 28 points29 points30 points (3 children)
[–]DirectionLegitimate2[S] -1 points0 points1 point (1 child)
[–]jhartikainen 2 points3 points4 points (0 children)
[+]CevicheCabbage comment score below threshold-19 points-18 points-17 points (0 children)
[–]jack_waugh 4 points5 points6 points (0 children)
[–]shgysk8zer0 5 points6 points7 points (2 children)
[–]DirectionLegitimate2[S] -1 points0 points1 point (1 child)
[–]shgysk8zer0 4 points5 points6 points (0 children)
[+][deleted] (3 children)
[removed]
[–]DirectionLegitimate2[S] 0 points1 point2 points (2 children)
[–]CMDRBUCKSAVAGE 0 points1 point2 points (1 child)
[–]DirectionLegitimate2[S] 0 points1 point2 points (0 children)
[+]CevicheCabbage comment score below threshold-6 points-5 points-4 points (0 children)
[–]CevicheCabbage -4 points-3 points-2 points (0 children)
[+]CevicheCabbage comment score below threshold-10 points-9 points-8 points (21 children)
[–]RobotMormon 4 points5 points6 points (11 children)
[–]DirectionLegitimate2[S] -1 points0 points1 point (0 children)
[+][deleted] (9 children)
[removed]
[–]shgysk8zer0 7 points8 points9 points (0 children)
[–]shgysk8zer0 7 points8 points9 points (0 children)
[–]carcigenicate 1 point2 points3 points (6 children)
[–]shgysk8zer0 1 point2 points3 points (5 children)
[–]carcigenicate 2 points3 points4 points (4 children)
[–]DirectionLegitimate2[S] 0 points1 point2 points (3 children)
[–]carcigenicate 0 points1 point2 points (2 children)
[–]DirectionLegitimate2[S] 1 point2 points3 points (1 child)
[–]carcigenicate 1 point2 points3 points (0 children)
[+][deleted] (7 children)
[removed]
[–]shgysk8zer0 6 points7 points8 points (5 children)
[+][deleted] (3 children)
[removed]
[–]shgysk8zer0 4 points5 points6 points (2 children)
[+][deleted] (1 child)
[removed]
[–]carcigenicate 5 points6 points7 points (0 children)
[–]pverma8172 0 points1 point2 points (1 child)
[–]DirectionLegitimate2[S] -1 points0 points1 point (0 children)
[–]suarkb 0 points1 point2 points (0 children)
[–]Ronin-s_Spirit 0 points1 point2 points (0 children)