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
In which of selye's stages in death a possible outcome?
kkurt [141]
D)Exhaustion
Hope this helps
6 0
3 years ago
Norman recently joined a team of technicians who work face-to-face. The team members have the expertise and experience needed to
almond37 [142]

Answer:

research and development team

Explanation:

Research and development team is a team in an organization that have the expertise, experience and responsibility to come up with innovative activities that will be undertaken by the corporations or organization in other to develop new services or products, or improve on existing ones.

3 0
3 years ago
Pundits attributed Obama’s 2012 victory to which social media site?
maksim [4K]

twitter i think -----------------------------

5 0
4 years ago
1.
Hatshy [7]

Answer:

Hi!

The following Javascript statement compares if num is 2 or 5 and increment num by 1 if true.

if ( num==2 || num==5)  

num = num +1;

Explanation:

The operator == is used to compare if the operands are equal.

The operator || is OR.

  • If at least one of the operands is true then return true.
  • If all operands are false returns false.

if( num==2 || num==5) <em> // if num is equal 2 or if num is equal 5</em>

num = num +1; <em>// adds 1 to num.</em>

8 0
3 years ago
In a typical e-mail address the host is
Tresset [83]
The receiver of an e-mail message. 
7 0
3 years ago
Other questions:
  • Susan bought a new sweater on sale for $28.93.she was charged HST of 13%.find the total amount of her bill including taxes.​
    9·1 answer
  • What daily life problems does the algorithm quicksort solve?
    14·1 answer
  • Design and implement a class Country that stores the name of the country, its population, its area, and the population density (
    6·1 answer
  • What percentage of business are using social media today
    14·1 answer
  • All 24-point fonts take up the same amount of space on a slide. True False
    7·2 answers
  • An address has a house number, a street, an optional apartment number, a city, a state and a postal code. Define the constructor
    5·1 answer
  • I need some help with this assignment. I'm having difficulty trying come up ideas to use here. Can I get any help?
    5·1 answer
  • In order to create a chart, which of the following must be selected?
    8·1 answer
  • What type of natural disaster stuck haiti in 2010 and killed more than 200,000 people
    9·2 answers
  • Why are computer simulations useful in studying phenomena in the universe?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!