I have a object from a Youtube api call, let's call it myObj I do a for loop and delete items I don't like with:
delete myObj.items[i]
the problem is it leaves "null" traces of items deleted this way, when i then log myObj again using JSON.stringify it looks like this:
myObj now is: {"kind":"youtube#SubscriptionListResponse","etag":"xxxxxxxxxxxxx","pageInfo":
{"totalResults":14,"resultsPerPage":30},"items":
[{"kind":"youtube#subscription","etag":"xxxxxx","id":"xxxxxxxxxx","snippet":{"publishedAt":"2020-12-
17T18:01:20.892352Z","title":"A Channel","description":"","resourceId":
{"kind":"youtube#channel","channelId":"xxxxx"},"channelId":"xxxxxx","thumbnails":{"default":
{"url":"xxxxxxxxxxxxxxxxxx"},"medium":{"url":"xxxxxxxxxxxxxxxxx"},"high":
{"url":"xxxxxxxxxxxxxxx"}}},"contentDetails":{"totalItemCount":17,"newItemCount":0,"activityType":"all"}}
,null,null,null,null,null,null,null,null,null,null,null,null,null]}
it works since it only keeps the "A Channel" item which is correct, but all the other items turn into null, and it's a problem for something like myObj.length later on.
I've read other threads about the issue, but they either reccomends using delete, which clearly doesn't work for my case, or splice (which doesn't work on my object from my understanding)