Explore
Explore snippets
Discover reusable code snippets, examples, fixes, and ideas shared by developers, students, and teams.
Public snippets by Pluto
1 public snippets
JavaScript
Public
Fetch Active Users
Fetches users from an API and returns only those who are active using async/await and ES6+ syntax.
JavaScript
Preview
const fetchActiveUsers = async (url) => {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const users = await response.json();
#api, fetch, async-await