/    Sign up×
Community /Pin to ProfileBookmark

JavaScript DOM task

Hello, I am a student and got this task as homework. Can someone solve it and explain how to do it?

TASK:

Use this example as a template: https://www.w3schools.com/js/tryit.asp?filename=tryjs_dom_date

Customize HTML and JavaScript as follows:

Create three “p” elements with IDs “start”, “counter”, and “end” (“demo” is no longer needed).

Assign the date and the current time to the “p” element with the ID “start” as content (before the content of “counter” is generated).

Assign the numbers 1 to 2’000 as content to the “p” element with the ID “counter”, where each number is displayed on a new line.

Assign the date and the current time to the “p” element with the ID “end” as content (after the content of “counter” is generated).

How long did it take to generate the 2’000 numbers? This depends on the concrete implementation in the script.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@sibertJan 14.2022 — And what is your attempt to solve the problem?
Copy linkTweet thisAlerts:
@darioroelliauthorJan 14.2022 — I've tried a few things and found that I'm on the wrong track. I need the solution to this task so that I can understand the basic principle for the next tasks. It would be a help.
Copy linkTweet thisAlerts:
@sibertJan 14.2022 — > @darioroelli#1641521 I've tried a few things and found that I'm on the wrong track.

What did you try and why was this the wrong track? Try to do a https://jsfiddle.net and show your attempt. Save it and paste the link here.
Copy linkTweet thisAlerts:
@cootheadJan 14.2022 — Hi there darioroelli

here is a counter example

[b]Full Page View[/b]

https://codepen.io/coothead/full/dyVabpp

[b]Editor View[/b]

https://codepen.io/coothead/pen/dyVabpp

[i]coothead[/i]
Copy linkTweet thisAlerts:
@darioroelliauthorJan 14.2022 — @coothead#1641523 thank you!
×

Success!

Help @darioroelli spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...