how can i remove __ob__: Observer from my array list?

Total
3
Shares

i have an array

data = [38589, 3, __ob__: Observer];

i want to send a put request API with the body sending this array. and got a 400 error?
is it this __ob__: Observer thing is being a problem for me to sending this data? if it’s the one that affect the error, can i know how to remove it from my array?


Solution

You can convert it to JSON and then back, if you want to get the final value of the array without the observer:

const finalData = JSON.parse(JSON.stringify(data));
Leave a Reply

Your email address will not be published. Required fields are marked *