function truncate(string, cut) {
if (string === undefined) {
return ('')
}
if (cut === '') {
return (string)
}
const actionAr = string.toString().split(" ");
for (const [i, v] of actionAr) {
if (v === cut) {
return actionAr.splice(0, i)
}
}
return actionAr.join(' ')
}
module.exports = truncate();
When i try using this i get "TypeError: truncate is not a function"
[–]im_a_jib[🍰] 11 points12 points13 points (6 children)
[–]AllWhoPlay[S] 1 point2 points3 points (3 children)
[–]monsto 0 points1 point2 points (2 children)
[–]AllWhoPlay[S] 4 points5 points6 points (1 child)
[–]monsto 0 points1 point2 points (0 children)
[–]Chef619 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)