Git Product home page Git Product logo

clickgame-with-javascript's Introduction

Introduction

This is a basic game to release stress and have some fun while clicking on the mouse and see your results on the boxes on the screen.

Documentation

Structure

HTML

1. The html page is simple with heading and three
   boxes with red, yellow and green colors and 
   also with a reset button which clears all
   your current scores.

Javascipt

1. Take all the buttons of coloured boxes with
   document.querySelectorAll. After this we will 
   get 3 <button> html.

2. We will loop through forEach for all the <button>
   html we got to get the value like 'red', 'green', 
   and 'yellow'.

3. We will make and object with its keys as 'red',
   'green', and 'yellow' and set their values as 0
   in the start.

4. The main logic is when we click on the boxes the
   onclick function will give the value of that 
   button as 'red' fo example, and we have made 
   'red' as our key already so we will increment 
   object.value by 1. In this example before::{'red': 0},
   after::{'red': 1} and add that 1 by innerText to button.

5. AFter that we made a rest button where in 
   all the object.value will be 0 and we will
   run a for loop for all three boxes by forEach
   to not show 0 in the box but to set '' empty
   string so it looks good.

clickgame-with-javascript's People

Contributors

apurv-here avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.