Skip to main content
InterviewHubPRO
Section Overview
Q372

Question 372 of 536

Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

69%
JavaScript & V8 Internals (536 Qs)•Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

How do you round numbers to certain decimals

senior LevelCode ExampleAsync & PromisesEvent LoopHTTP & REST APIs

You can round numbers to a certain number of decimals using toFixed method from native javascript.

javascript
  let pie = 3.141592653;
  pie = pie.toFixed(3); // 3.142