let lastTime = performance.now();let frameCount =0;let fps =0;functionupdate(){
// Get the current time
const now = performance.now();
// Calculate the time difference since the last frame
const delta = now - lastTime;
frameCount++;if(delta >=1000){
// Update the FPS value
fps = frameCount / (delta / 1000);
// Reset the counters
frameCount =0;
lastTime = now;
// Log the FPS
console.log(`FPS: ${fps.toFixed(2)}`);}
// Request the next frame
requestAnimationFrame(update);}
// Start the update loop
update();