Increment a Counter
easyQuestion 183The span with id="counter" holds the number 5. Read it, add 1, and write the new value (6) back as its text.
Platform-Provided HTML (READ-ONLY):
<span id="counter">5</span>Steps:
1. Read the current text and convert it to a number with parseInt().
2. Add 1 and assign the result back to textContent.
Expected output
<span id="counter">6</span>= newline. No newline after the last line.
Hints2 available
Sign in to use hintsTopics
HTML DOM
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.