Ask Question
11 August, 12:33

Write a jа vascript function named countUp (), which displays 1 to 10.

+2
Answers (2)
  1. 11 August, 13:20
    0
    Following are the code in jа vascript

    Try it

    Explanation:

    In this program when we click on button " Try it " it call the jа vascript function countUp () which display the value from 1 to 10.

    output

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10
  2. 11 August, 15:32
    0
    class countUp {

    constructor () {

    for (let i = 1; i < = 10; + +i) {

    console. log (i);

    }

    }

    }

    const count = new countUp ();

    Explanation:

    To solve the problem we create a class called countUp with the main method called constructor, inside constructor we have a for loop that iterates from one to ten increasing the variable i by one after each iteration, inside the for is a console function to print the numbers from one to ten one at a time. Note that for this program to work we need to instantiate the class countUp using the variable count.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a jа vascript function named countUp (), which displays 1 to 10. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers