programming-examples/js/Object/Returns a subset of a string.js
2019-11-15 12:59:38 +01:00

14 lines
298 B
JavaScript

String.prototype.sub_String = function()
{
var subset = [];
for (var m = 0; m < this.length; m++)
{
for (var n = m+1; n<this.length+1; n++)
{
subset.push(this.slice(m,n));
}
}
return subset;
};
console.log("dog".sub_String());