What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-20 20:44:03
string reduction javascript
// method to extend String to call reduce the same way as an Array String.prototype.reduce = function () { return this.split().reduce(...arguments); } // sum of the ascii codes using the newly created String prototype method str.reduce((a,b) => a... Add solution -
Javascript 2021-08-31 21:11:03
javascript prototype vs constructor function
function Class () {} Class.prototype.calc = function (a, b) { return a + b; } // Create 2 instances: var ins1 = new Class(), ins2 = new Class(); // Test the calc method: console.log(ins1.calc(1,1), ins2.calc(1,1)); // -> 2, 2 // Change the p... Add solution
Best helpers
Eric Vought
+5
James Song
+5
Fishbean
+5
Mai Rose
+5
Bob R Bogle
+5
Gruppetto
+5
Katboodle
+5
Vidhi Patel
+5
Buttercup
+5
Bin Nguyễn
+5