r/javascript • • Aug 15 '21

How To Use A Web API With Pure JavaScript

https://dev.to/ismailisimba/how-to-read-and-use-a-restful-web-api-with-javascript-a-studio-ghibli-example-58co
0 Upvotes

4 comments sorted by

4

u/CupCakeArmy Aug 15 '21

let obj = {"Not":"Found"}; // ... return obj

I hope this is irony

-1

u/ism9gg Aug 15 '21

Why? What am I missing?

3

u/CupCakeArmy Aug 15 '21 edited Aug 15 '21

Where to begin... That's what null is made for, do not return some custom object to check if something was found.

Also the search loop is super messy. You could remove that function by simply using native JS methods on object and arrays

Edit: That said, one only learns by doing so keep going :)

2

u/ism9gg Aug 15 '21

Thanks.