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
How do keygens work?
Artist 52 [7]
What are keygens please

3 0
4 years ago
Which type of evidence should victims collect to help officials catch cyber bullies?home addressesbirthdayssocial media username
skad [1K]
Bjejfjdjdjdjdjdjdjdndjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjddjjddjjdjdjdjd
3 0
3 years ago
Logical are functions used when looking for an entry or value in the spreadsheet. what is it?
Mila [183]

Explanation:

Logical functions provide decision-making tools for information in a spreadsheet. They allow you to look at the contents of a cell, or to perform a calculation, and then test that result against a required figure or value.

5 0
3 years ago
. Complete the code, drawing a line between points (100, 200) and (34, 67)
Galina-37 [17]

Answer:

The answer for the given question is given below:

public void paint( Graphics g )

{

g.drawLine(100, 200 ,34, 67);

}

Explanation:

In this code we are using “drawLine” method to draw the line between the points

The graphics object “g” is to call the drawLine method .

The syntax of drawline method is given below

drawLine(int X1, int Y1, int X2, int Y2)

Where  X1,  Y1,  X2,  Y2 are the points in the x and y coordinate

Following are the full code of that program  

import java.applet.Applet; // package of applet

import java.awt.Graphics; // package of awt  

public class line1 extends Applet  //inherit applet class

{

public void paint( Graphics g ) // paint method

{

g.drawLine(100, 200 ,34, 67); // drawline

}

}

It draw the corresponding line between the coordinate

8 0
3 years ago
What do the letters of the su command stand for? what can you do with su besides give yourself root privileges? "what can you do
Viefleur [7K]
Super User.
Execute commands that require root privileges.
Log in as the root user, then type 'passwd user'<span>
</span>
4 0
4 years ago
Other questions:
  • To what device, inside the computer, do all other devices connect
    10·2 answers
  • The smallest unit of time in music called?
    6·2 answers
  • An existing document that you use as a starting point for a new document; it opens a copy of itself, unnamed, and then you use t
    15·1 answer
  • A written guarantee to fix or replace an item is called a _____.
    5·2 answers
  • ____________________ software is a type of security software designed to identify and neutralize web bugs, ad-serving cookies, a
    8·1 answer
  • Spell checker will find every mistake you make in a document and correct it. A. True B. False
    9·2 answers
  • Items that represent features of smartphones apps
    12·1 answer
  • When was "Rick Astley Never Gonna Give You Up" originally made?
    6·2 answers
  • Hola buenas tardes, mi problema es el siguiente, en Word quiero alinear los párrafos por separado, pero, así lo sombree una line
    8·1 answer
  • I don't want my large video files using up all my hard drive space . can i archive my videos in on dvds or blu rays?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!