Skip to content

Instantly share code, notes, and snippets.

@lukluk
Created October 23, 2015 07:02
Show Gist options
  • Save lukluk/58796ddfa9c2fc27b912 to your computer and use it in GitHub Desktop.
Save lukluk/58796ddfa9c2fc27b912 to your computer and use it in GitHub Desktop.
Javascript quiz
#1. JS FRONTEND
STORY : saya punya koleksi url dari sebuah API, saya mau mendapat semua hasil dari setiap url yang di pangil secara PARALEL
atau bersamaan
CATATAN : kita tidak ingin mengunakan modul/lib apa pun, semuanya native js
TODO : buatlah function 'getAnyMember' yang akan memberikan callback berserta resultnya
EXAMPLE RESPONSE EACH URL :
{id:1,name:'jhon'}
CLUE :
var url=['http://api.example.com/gold/id/1','http://api.example.com/silver/id/2','http://api.example.com/silver/id/3','http://api.example.com/black/id/4']
var resultAll=[]
getAnyMember(url,function(result){
resultAll=result
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment