Hello friends I have a small impasse, it turns out that I need to show some percentages on my website and these come with your decimal:
50.893921334923
49.106078665077
I just need to show the whole value for that I separate them by the point with split and I show it with $scope
but the problem is that if I add the two whole values it gives me 99 and not 100% is obvious because the sum of the decimals completes it but for the view NO.
starting at the lower number added one but when the database grows it is no longer useful:
var enero = localStorage.getItem("enero");
var febrero =localStorage.getItem("febrero");
var eneroentero = parseInt(enero.split('.')[0]);
var febreroentero = parseInt(febrero.split('.')[0]);
var enerodecimal = parseInt(enero.split('.')[1]);
var febrerodecimal = parseInt(febrero.split('.')[1]);
if (enero>febrero) {
$scope.febrero = febreroentero + 1;
$scope.enero = eneroentero;
}
else {
$scope.enero = eneroentero + 1;
$scope.febrero = febreroentero;
}
if (enero==febrero) {
$scope.enero = eneroentero;
$scope.febrero = febreroentero;
}'
Then how could I apply a solution?
Thank you.