CJCoding With Joseph

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>
Topics:
HTML DOM
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.