Test Yourself: Prerequisites

Test your knowledge of JavaScript and React before you take the lessons in this course.

Choose the correct answer(s).

1

Which parts of the document get rerendered after the timer updates in the code below?

function tick() {
  const element = (
     <div>
      <h1>Hello, world!</h1>
      <h2>Time = {new Date().toLocaleTimeString()}.</h2>
     </div>
  );
  ReactDOM.render(element, document.getElementById('root'));
}

setInterval(tick, 1000);
A)

The whole content

B)

Only the h1 element

C)

Only the h2 element

D)

Nothing

Question 1 of 150 attempted

Get hands-on with 1200+ tech skills courses.