Skip to content
Advertisement

How to remove the first and last item in a list?

I have the List

JavaScript

How do I remove the first element, Q and 0002, the last element?

Advertisement

Answer

I’m not sure exactly what you want since it is unclear but this should help. You actually only have a single element in that list.

Assuming all your list items are strings with spaces as delimiters, here is how you can remove the first and last group of characters from each string in the list.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement