Looking around Stackoverflow, I have came across this JSFiddle, however this script appears to have errors inside, of which due to my experience I do not fully understand how to repair.
Running through JSBeautifier, all of the code is nicely indented apart from the following having no indents;
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 100, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 0, // the number of decimal places to show
onUpdate: null, // callback method for every time the element is updated,
onComplete: null, // callback method for when the element finishes updating
};
})(jQuery);
In addition to this, I wish to add commas to my number like so:
Number(10000).toLocaleString('en'); // "10,000"
1). How to fix the code a person answered on Stackoverflow, got rated up and marked as the answer regardless of the errors found?
2). How do I add commas to the output?