I'm messing around with this open API that I found. I returns a random Ron Swanson quote each time you GET from it.
The problem is that each the response.data comes out like this:
[ "Fish, for sport only, not for meat. Fish meat is practically a vegetable." ]
with brackets surrounding the text - which I don't want. Ive tried using slice() to get rid of the brackets but it doesn't seem to work.
What very simple thing am I missing?
Just did a quick google search to find the API you are using -- https://github.com/jamesseanwright/ron-swanson-quotes is what it looks like.
Instead of returning a string with brackets, this API returns an array with a single value! So no need to perform any string manipulation, just access response.data[0] to get the string that you want.
Edit: Slice would have been the correct way to remove the brackets if they were a part of the response string. Good instinct!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With