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
Explain SATA peripheral bus operation?
grin007 [14]
Peripheral Bus is not associated with the SATA function on a computer as they are not universal to each other. If you can go more into context, that would be great.
3 0
3 years ago
Once Raul selects a technology solution, he has completed the process. <br> a. True<br> b. False
romanna [79]
The answer is true because choosing a technology solution is the last step
7 0
3 years ago
Read 2 more answers
What is the body of scientific knowledge based on?
ANTONII [103]
It depend on all such as guess ,observation ,hypothesis and etc
3 0
2 years ago
Read 2 more answers
What amount of memory enough to store alatter of the alphabet or store a small number​
laiz [17]

Answer:

It can be "ON" or "OFF". So it can store the numbers 1 and 0, but it certainly doesn't have the capacity to store a letter of the alphabet.

Explanation:

3 0
2 years ago
What important advice to include about spyware, viruses and other types of malware
S_A_V [24]

Answer:

You should probably include the fact that most of these things will disguise themselves as fake downloads and that will most of the time claim to allow you to download something that costs money for free.

Explanation:

thats all i could come up with

5 0
2 years ago
Read 2 more answers
Other questions:
  • You can use Facebook's live feed tool to broadcast content as you post it
    8·2 answers
  • Technological _____ is the term used to describe the merging of several technologies into a single device.
    13·1 answer
  • Using the _____ model brings sellers and buyers together on the web and collects commissions on transactions between these parti
    5·1 answer
  • Respecting culture in the workplace means understanding that
    5·2 answers
  • How are clustering and Network Load Balancing similar?
    13·1 answer
  • From the following list choose all the tasks an operating system performs.
    5·2 answers
  • Which statement correctly compares blank presentations and themed presentations?
    12·2 answers
  • #Write a function called hide_and_seek. The function should #have no parameters and return no value; instead, when #called, it s
    7·1 answer
  • Designers and graphic artists can print finished publications on a color printer, take them to a professional printer, or post t
    15·1 answer
  • The memory capacity in bits for performing the operation y = f (x) using the table lookup method, where x is an 8-bit number and
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!