'Execution time to be printed in html page

I've created a loan calculator using Javascript. But I've been thinking of adding the time taken for the code to execute the results. I wanted the execution time to be printed in my html page but I have no idea how to go forth. Please help!!! This is the code of loan calculator: https://github.com/gerhynes/loan-calculator

I've tried it by console logging the execution time but it didn't go as expected but I wanted it to be printed in my html.



Solution 1:[1]

let LogStarts = performance.now();

loanCalculator();   // <---- The function you're measuring time

let LogEnds = performance.now();
console.log("Loan Calculator took " + (LogEnds - LogStarts) + " milliseconds.");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pedro Barreto