Giter Club home page Giter Club logo

modulo-2-evaluacion-intermedia-patriciapoveda's People

Contributors

patriciapoveda avatar

Watchers

Miguel del Mazo avatar

modulo-2-evaluacion-intermedia-patriciapoveda's Issues

Improvements

Really cool job @PatriciaPoveda !!!

Here you have some tips to improve the exercise:

JavaScript: basic

  • Define the logic to make the counter work.

JavaScript: advanced

  • Move you counter logic into a function and execute it on each click.
  • You are writing many times "trackEl.innerHTML = 'something';", what about making a function that accepts a string as param and paints it into 'trackEl'?

HTML

  • Add form
  • Use a label to define the content of the input.
  • Connect the label to the input using the for attribute of the label and the id of the input.
  • Use placeholder.

Steps to finish the game (for those far from the solution)

You are close to the exercise solution, but here you have a steps guide to complete it anyway ;)

  1. Save a reference to DOM elements in variables.
  2. Generate the random number and save it to a variable.
  3. Init counter of trials to 0.
  4. Define a function that executes when the user clicks on the button, that
  • increments the counter and paints its value in the HTML.
  • collect the value of the HTML input and compare it with the random number.
    • if they are equal, draw a 'You Win' message.
    • if it's lower, draw a 'Too short' message.
    • if it's higher, draw a 'Too long' message.
  1. Assign a listener to the button click to execute the previous function.

Further challenges

Then you can improve the game as you please, here you have some ideas:

  • Add new feedback when the number is bigger than 100 or smaller than 0.
  • Manage when the user hits the button and the input is empty.
  • Make the input work when hitting enter key.
  • Add a reset button that cleans the input, the counter, writes the initial feedback and generates a new random number to play again!
  • Whatever you want!

Call to action

Let me know if you have any doubts ;)

Go for it!!

Do not close this issue until your teacher asks you to

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.