You've defined a function to fetch data. Now, you'll want to see how long this async function fetchData takes to complete its execution. To achieve this, use the PerformanceObserver class. Remember, there's no need to call the fetchData function again; it's already been called for you, with performance entry points marked. You should only log the duration of this performance entry, and make sure it's in milliseconds.
Intro to performance hooks
Measuring the Performance of fetch
Report a typo
Write a program in JavaScript
const { PerformanceObserver } = require('perf_hooks');
// Create a performance observer to measure the duration of the asynchronous function
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.