Skip to content

Instantly share code, notes, and snippets.

@valerymelou
Created May 20, 2018 10:29
Show Gist options
  • Save valerymelou/1733bcfd02ab33e54a842006e83f3f34 to your computer and use it in GitHub Desktop.
Save valerymelou/1733bcfd02ab33e54a842006e83f3f34 to your computer and use it in GitHub Desktop.
Array.prototype.decimalfy = function() {
for (var i = 0; i < this.length; i++) {
this[i] = this[i].toFixed(2);
}
};
var digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
for (var index in digits) {
console.log(digits[index]);
}
/**
0
1
2
3
4
5
6
7
8
9
function() {
 for (let i = 0; i < this.length; i++) {
  this[i] = this[i].toFixed(2);
 }
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment