This is a short question which only requires one state variable, which is the number of times the button has been clicked (count
).
Declare count
as a variable. Attach a callback on <button>
's on:click
handler and increment count
value within it. count
will now be incremented whenever <button>
is clicked.
Note: This is a short warm up question meant to help you familiarize with the coding workspace. Actual UI coding interview questions will be more complicated.
Make the text within the button display the number of times the button has been clicked.
This is a short question which only requires one state variable, which is the number of times the button has been clicked (count
).
Declare count
as a variable. Attach a callback on <button>
's on:click
handler and increment count
value within it. count
will now be incremented whenever <button>
is clicked.
console.log()
statements will appear here.