.toFixed()returns a string (see the MDN documentation ), so it getPoints + addPointconcatenates strings, not appends.
:
var getPoints = +$('.awesome-points').text();
var newScore = getPoints + 1;
$('.awesome-points').text(newScore.toFixed(1));
:
$('.awesome-points').text(function(i, val) {
return (+val + 1).toFixed(1);
});
:
.text(), . . , , , - . .
.text().
(+val + 1).toFixed(1) : val (+val), (+ 1). .toFixed(1) .
+val NaN, . , ,
return ((+val || 0) + 1).toFixed(1);
, , +val false ( NaN), 0. JavaScript, . "options = options || {}" Javascript?.