I'm trying to strip all the spaces out of the contents of my array.
Here is my array
var array = ["option 1", "option 2", "option 3"]
I've tried using the answer found here: how do I strip white space when grabbing text with jQuery?
This is what the jQuery I'm trying to use.
$(array1).each(function(entry) {
$(this).replace(/\s+/g, '');
console.log(entry);
});
But it throws a TypeError: undefined is not a function (evaluating 'entry.replace(/\s+/g, '')')
What am I missing?