Skip to content

Commit

Permalink
Removed extra lines of code
Browse files Browse the repository at this point in the history
  • Loading branch information
iamzaidsoomro authored Oct 21, 2021
1 parent 9a85999 commit 8262755
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions JSON application/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ <h2 class="mt-4">Fetching GIT usernames via an API using JSON</h2>
<!-- <li></li> -->
</ul>
</div>



<script>
let fetchBtn = document.addEventListener('click', fetchHandler)
let list = document.getElementById('list')
Expand All @@ -30,33 +27,18 @@ <h2 class="mt-4">Fetching GIT usernames via an API using JSON</h2>
let url = "https://api.github.com/users"
const resp= await fetch(url);
const users = await resp.json(); //convertng the resp into object via JSON
// console.log(users)


// console.log(users)
let html=""
//Iterating through each array and printing the "login" on the DOM.

users.forEach(element => {
html+=` <li>${element.login}</li>`

});
//appending the final html into our list i.e. <ul> element

list.innerHTML=html;


list.innerHTML=html;
}






fetchUsers();//calling fetch users
}



</script>
</body>
</html>
</html>

0 comments on commit 8262755

Please sign in to comment.