Let’s now see how much time the previous function takes to execute. In a Jupyter Notebook or any language interpreter, you can use the following script to find the time taken by the algorithm.
xxxxxxxxxx14
function customPower(x, y) {    let result = 1;    for (let i = 0; i < y; i++) {        result = result * x;    }    return result;}var start = new Date().getTime();console.log(customPower(3, 4));var end = new Date().getTime();console.log(`Call to customPower took ${end - start} milliseconds`);OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment



