1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Eva8 [605]
3 years ago
12

Write a setInterval() function that increases the count by 1 and displays the new count in counterElement every 300 milliseconds

. Call clearInterval() to cancel the interval when the count displays 5.
var count = 0;


var counterElement = document.getElementById("counter");


counterElement.innerHTML = count;



/* Your solution goes here*/
Computers and Technology
1 answer:
Alina [70]3 years ago
8 0

Answer:

  1. var count = 0;
  2. var counterElement = document.getElementById("counter");
  3. counterElement.innerHTML = count;
  4. var a = setInterval(
  5.    function(){  
  6.        count++;
  7.        counterElement.innerHTML = count;
  8.        if(count == 5){
  9.            clearInterval(a);
  10.        }
  11.    }
  12.        , 300);

Explanation:

The solution code is given from Line 6 - 15.  

setInterval function is a function that will repeatedly call its inner function for an interval of time. This function will take two input, an inner function and the interval time in milliseconds.  

In this case, we define an inner function that will increment count by one (Line 8) and then display it to html page (Line 9). This inner function will repeatedly be called for 300 milliseconds. When the count reaches 5, use clearInterval to stop the innerFunction from running (Line 11 - 13).  

You might be interested in
Comptel, a world leader in computer hardware, differentiates itself from its customers by providing excellent after-sales servic
nignag [31]
❤️The answer is supply chain effectiveness.


Hope you have a great day!
4 0
3 years ago
Robert wants to start a mobile app development company that builds apps for both iOS and Android. He is researching different cr
kondaur [170]

Answer: phonegap and xamarin

Explanation:

phonegap and xamarin

6 0
3 years ago
How do you attach an image in brainly? Like if you have a question, but people answering it need to see a picture of what you're
rjkz [21]

1. Ask your question.

2. Click the paperclip.

3. Attach an image from camera roll (on a device) or your digital files from a computer.

6 0
3 years ago
One of the key advantages the soviet union held over the united states on a global scale was america's continuing issue of:_____
ikadub [295]

Explanation:

The Americans had a greater nuclear power with more than 300 land based intercontinental ballistic missiles (ICBMs) and a fleet of Polaris submarines. The Soviet Union had only 4 to 6 land based ICBMs and around 100 short range primitive V1 type cruise missiles that could only be launched from surfaced submarines.

6 0
2 years ago
Which will be displayed after the following process is completed?
Sergeu [11.5K]

Answer:

True

Explanation:

In this pseudocode the programmer defines 3 variables, x=1, y=2 and z=3, then he creates a conditional that states that if any of the previously defined variables has the value of 1 then a True will be displayed, on the other hand, if none of the variables has the value of 1 then a False will be displayed. In this case x=1, so it will display a True.

8 0
3 years ago
Other questions:
  • *****NEED HELP ASAP!!!! COMPUTER HELP!!!! PLEASE!**
    13·1 answer
  • What is virtual reality?
    10·1 answer
  • _____ is a form of witty, amusing speech that is often used to bring people together.
    7·2 answers
  • Before creating a brief to design a product, what is needed
    8·1 answer
  • Which of the following is best known as a business network LinkedIn, Facebook, Twitter or Word Press?
    15·1 answer
  • Brainliest for correct answer
    13·2 answers
  • A loop that will output every other name in the names list.
    11·1 answer
  • What is 2D thinking and 3D thinking? i literally don't understand
    6·1 answer
  • Help brainleist giving exam
    15·1 answer
  • What are the different elements of a window?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!