CJCoding With Joseph
15free / daySign inCreate account

Increment a Counter

The 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
Topics:
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.