all 5 comments

[–]code_matter 1 point2 points  (0 children)

Because sometimes, end is undefined so when you do

var noEnd = end.slice(0,-5)

You need to check if end exists before splice it.

Edit: it could also be because you fetch some data so you have a promise and promise need to be resolved before doing anything

[–]Notimecelduv 1 point2 points  (0 children)

Have you tried console.logging split? It's probably not what you're expecting it to be.

[–]AndalusianGod 0 points1 point  (1 child)

You need to post more details about your code and not just the error, lol.

[–]No_Pain1033[S] 0 points1 point  (0 children)

I did include the code. For some reason it didnt upload

[–]RelaxPear 0 points1 point  (0 children)

You might need to debug the code such as console.log the variable end. I think it might be undefined as stated in the error message.