Dealing With Weird APIs in JavaScript...

preview_player
Показать описание
Have you used the fromEntries function before?

Prepping for your frontend interviews? Use code "conner" for a discount on my product FrontendExpert:

Рекомендации по теме
Комментарии
Автор

The fact that I haven't had the misfortune of using an API that returns object entries should be considered a scientific proof that god exists

dough-pizza
Автор

I've been scratching my head over nested arrays and your short comes by 😂

khaledMohamed-tpwx
Автор

Brother if I am stuck using an API that returns 2-item arrays as a substitute for key-value pairs I am ditching that API and writing my own

nc
Автор

Nice solution for a problem that shouldn't exist anyway

TheMat
Автор

Also: const map = new Map(entries)
The Map() constructor directly accepts an entries array. In my view, it’s a more natural transformation. It also preserves the order of the original array.

boazamit-danhi
Автор

And this is why javascript is really cool. I don't like it for much, but it brilliantly handles data structure transformations.

kanaverum
Автор

calling them “nested arrays” is a bit misleading, they’re tuples and can be strictly typed like `[string, number]` whereas an array would need to be `(string | number)[]`. but still good point overall

uspecl
Автор

Never seen any api gives these kind of data. If the api creator is weird and don't have any knowledge about JSON then maybe it's possible.

mdtajbirhossain
Автор

+1 thing to my current JS knowledge which is console.log(); 😂😂

JohnGray-uo
Автор

And what happens if two entries have the same key?

LewisMoten
Автор

I'm Connor, the return value sent by a god forsaken API

reda
Автор

Why u constructing this like that in the first place its weird practice

NOINN
Автор

So Array is list, obj is dict in python
I dont know java hurray 😂

tuhin
join shbcf.ru