A Javascript Counter | Html, Css & Js

A Javascript Counter | Html, Css & Js

SIDEHUSTLE TASK | WEEK 3

What is Javascript?

JavaScript is the world's most popular programming language.

JavaScript is the programming language of the Web.

JavaScript is easy to learn. ... w3schools

Javascript is a programming language that adds functionality to your website. A set of codes in HTML and CSS, will only add structure and style to your webpage. Javascript is used to add functions to buttons, create animations, develop games and different web apps. Javascript has a lot of frameworks (I will be sharing this in my next post).

Sidehustle Week 3 Task...

This is the Week 3 of my SIDEHUSTLE INTERNSHIP, and the task given is Js Beginner Counter.

How to create a Javascript Counter?

With a few sets of code on HTML and CSS, I created a structure and added style to the counter. With a desired outlook, I applied these sets of Javascript codes to it.

let count = 0;

const value = document.querySelector("#value");
const lowerBtn = document.querySelector("#lower-btn");
const addBtn = document.querySelector("#add-btn");


lowerBtn.addEventListener("click", () => {
    if(count > 0) {
        count--;
        value.innerHTML = count;
    }
});

addBtn.addEventListener("click", () => {
    if(count < 50) {
        count++;
        value.innerHTML = count;
    }
});

To view my codes, here is a link to my Github repository with the hosted site link

Generally, coding has been fun for me, giving my ability and interest for creativity. I see this as an opportunity to create something more useful and beneficial to my environment.

Thanks to Sidehustle Internship for this opportunity.