S
Seoffix.com
Sign In Get Pro Membership
JavaScript Beginner
Estimated Duration: 15 min

JavaScript: Modern Async/Await & Fetch API

Master asynchronous JavaScript using modern async/await syntax to fetch remote JSON data cleanly with try/catch error handling.

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

javascript
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.
Target Output
2
Need a Hint?
  • Use the .filter() method on tools array
  • Condition is t.rating >= 4.5
  • Return .length of the filtered array
solution.js
Terminal Output Ready
Click "Run Code & Test" to execute your solution.