JS fetch... how to return arguement value so we can reuse the function easily..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

JS fetch... how to return arguement value so we can reuse the function easily..?

I was trying to make a YouTube live subscribers counter. I did it for one user, but then I wanted to do it for multiple users at the same time. But I’ve been scratching my head 7283 times and can’t figure it out. Normally it would be something like this: x.innerHTML = getSubsCount(Me, something) y.innerHTML = getSubsCount(You, something) But with this fetch Ali thing... I don’t know how to work around it. A little example on what I’m talking about https://code.sololearn.com/WapXhxCK1w2D/?ref=app https://code.sololearn.com/W5W5t8xGKJS7/?ref=app

23rd Oct 2020, 6:55 AM
Ginfio
Ginfio - avatar
1 Answer
+ 1
It's not possible. You can find some alternatives here https://www.sololearn.com/discuss/2552332/?ref=app
23rd Oct 2020, 10:16 AM
Kevin ★