In Python, you can use a list comprehension with the strip() method to strip each element in a list:
main.py138 chars4 lines
In JavaScript, you can use the map() method to apply the trim() method to each element in an array:
index.tsx152 chars4 linesNote that trim() removes whitespace from the beginning and end of a string in JavaScript, while strip() removes both leading and trailing spaces, tabs and newlines from a string in Python.
gistlibby LogSnag