How to make your own countUp.js plugin using JavaScript ? Last Updated : 18 Jan, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report prerequisite: Document Object Model ( DOM ) Use of Classes in ES6 If you are a beginner in JavaScript and have basic programming knowledge then don't worry, you have landed in a perfect place. Let us divide the problem into multiple segments: Implementing a simple structure using HTML.Providing a basic display style using CSS.The main programming to implement, the behavior using JavaScriptonclick="....( )" : To trigger the functionCreating a class with the name CounterUsing a constructor to initialize the classCreating the method/function with the name shoot( ) for animationCalling the method shoot from the class Counter Step 1: Implementing the HTML HTML <!---inside body----> <div class="container"> <img src= "https://media.geeksforgeeks.org/wp-content/uploads/20200326201748/download312.png" /> <div class="main"> <h1 id="counter"> _______ </h1> <!-- This is the target id --> <button onclick="trigger()"> START </button> </div> </div> <!-- Inside body --> <script> // Including JavaScript Code </script> Step 2: Implementing the CSS CSS .container { display: flex; padding:20px; } .main{ padding:20px; } button{ width:100px; height:45px; background-color:#33ff33; border-radius:10px; } Step 3: JavaScript JavaScript // Creating the Class: Object Prototype class Counter { // Countructor: Initializing the Class constructor(data) { this.start = data["start"]; this.end = data["end"]; this.frames = data["frames"]; this.step = data["step"]; this.target = data["target"]; } // Method for Animation shoot() { // Variables var count = 0; var stepArray = []; // Putting the starting Value document.getElementById(this.target) .innerHTML = this.start; // Storing the step value in Array while (this.end > this.start) { this.start += this.step; stepArray[count++] = this.start; } // Doing Countup Animation var functional_target = this.target; for (let i = 0; i < count; i++) { setTimeout(function () { document.getElementById(functional_target) .innerHTML = stepArray[i]; }, (i + 1) * this.frames); } // Placing the final value setTimeout(function () { document.getElementById( functional_target).innerHTML = this.end; }, count * frames); } } // Creating object from class var animate = new Counter({ start: 100000, end: 2000000, frames: 1, step: 1000, target: "counter" }); // Triggering the Class Method function trigger() { // Calling the shoot() method of the class animate.shoot(); } Output: Custom Countup Preview Main Used Functions: document.getElementById(Target Id).innerHTML setTimeout( function() { Function Here } , timedelay ) OVERVIEW The flow of the Program This is the basic prototype of the custom countUp.js that we can implement using the concept of Class in JavaScript. One can also use their own function to render the values in specific ways. Comment More infoAdvertise with us Next Article How to make a word count in textarea using JavaScript ? S sandeep10shaw Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads How to make a word count in textarea using JavaScript ? Counting words may be useful in scenarios where the user is recommended to enter a certain number of words and the word counter can keep track of the same. Below are approaches to make a word count in textarea using JavaScript:Table of Content Calculating the number of spaces present in the textSepa 4 min read How to make animated counter using JavaScript ? Creating an animated counter with JavaScript is an easy way to make your website more interactive. It smoothly increases or decreases numbers, which is great for displaying stats or other dynamic content. You can easily customize the speed and timing using HTML, CSS, and JavaScript.Approach :Making 3 min read How to Count Records in JSON array using JavaScript and Postman ? In this article, we are going to explore how JavaScript and Postman are used to count the number of records returned in a JSON array. Send a Request: Send a request to fetch the JSON array from your API endpoint in Postman.Access JSON Response: In the Postman test scripts tab, you can access the JSO 2 min read How to count words in real time using jQuery ? In this article, we will learn how to count words in real-time using jQuery. We have an input field, and when we type, we get the number of words in the input in real time. Approach: First, we select the input field and store its value in a variable. We call a function called wordCount() when a keyb 2 min read How to count the number of times a button is clicked using JavaScript ? At times, it becomes necessary to monitor the number of times a user clicks a button. In this article, we are going to learn how to count the number of times a button is clicked using JavaScript Below are the approaches to count the number of times a button is clicked using JavaScript Table of Conte 3 min read Counting Sort Visualization using JavaScript GUI(Graphical User Interface) helps in better in understanding than programs. In this article, we will visualize Counting Sort using JavaScript. We will see how the frequencies of elements are stored and how we get the final sorted array. We will also visualize the time complexity of Counting Sort. 4 min read Like