6 months ago
9 lines352 B
fetch("https://api.github.com/repos/torvalds/linux") | |
.then(res => { | |
if (!res.ok) throw new Error(`HTTP ${res.status}`); | |
return res.json(); | |
}) | |
.then(repo => console.log(`${repo.full_name}: ${repo.stargazers_count} stars`)) | |
.catch(err => console.error("Request failed:", err.message)); | |
| |
// Try changing the values above and run it again. |