Edit in JSFiddle

const startTest = () => {
  const ITERATION_COUNT = 100000;
  const iterateWithNoRealPurpose = () => {
    for(let i = 0; i < ITERATION_COUNT; i++) {
      dummyNode.innerHTML = i;
    }
    dummyNode.innerHTML = '';
  }

  const ZERO_MILISECONDS = 0;
  const showMeasuredTime = () => {
    const timeOfExecution = window.performance.now();
    const resultText = `Time after I executed ${timeOfExecution - timeBefore}`;
    result.innerHTML = resultText;
  };
  const timeBefore = window.performance.now(); // get current timestamp in "miliseconds.microseconds"

  setTimeout(showMeasuredTime, ZERO_MILISECONDS);

  iterateWithNoRealPurpose(); // try to comment this line to see how the result is affected
};

startTestButton.addEventListener('click', startTest);
<div id="dummyNode"></div>
<div id="result"></div>
<button id="startTestButton">Start test</button>