I have this function taken from here: smart way to shorten long strings with javascript
String.prototype.trunc = String.prototype.trunc ||
function(n){
return (this.length > n) ? this.substr(0, n-1) + '…' : this;
};
var randNumb = Math.floor((Math.random() * 100000000000000000));
randNumb = randNumb.toString();
randNumb = randNumb.trunc(16);
Today when i tried to use my webpage i got the following error:
Uncaught (in promise) TypeError: randNumb.trunc is not a function
at main (displayData.js:53)
at HTMLButtonElement.onclick ((index):1)
It worked fine yesterday and i haven't changed this part of the code since then. Does anyone have an idea what has happened?
Edit: I found the problem... I apparently changed some code without meaning to. Thanks for the help anyway.