I just started learning JavaScript. I have a paragraph that I split using str.split('.'). Additionally, I need to remove quotes from the split string. How to remove them?
My mother stood up and picked up a box from the ground. "We're in America, Rune. They speak English here. You've been speaking English, just like you've been speaking Norwegian. It's time to use English."
I hope the result is as follows:
My mother stood up and picked up a box from the ground. We're in America, Rune. They speak English here. You've been speaking English just as much as you've been speaking Norwegian. It's time to use English.
It would be easier to remove all quotes before splitting the array.
If you insist on splitting the array first, then you should loop/map each sentence after
.split
.As you can see, the last item is the empty string. To remove it you can also use
.filter()
.To remove spaces, you can also use
.trim()
.So, putting it all together: