JavaScript Async/Await & Fetch API
Modern JavaScript handles asynchronous operations with sync functions and the wait operator, making asynchronous code look and behave like synchronous code.
Syntax
async function loadData() {
try {
const res = await fetch(url);
const data = await res.json();
return data;
} catch (err) {
console.error(err);
}
}
Your Task
Write an async function called calculateToolMetrics(tools) that filters tools with a rating of 4.5 or higher and returns their total count.