Capture user inputs in Javascript
I always had difficulties applying concepts in JavaScript, and you might say that is common when you are a beginner to programming, but I can assure you that in my case I had to struggle to understand the basics in JavaScript, and yes I still do.
This week I studied on a project inspired by Chris and his “Fun javascript projects”, and I’ve built a guessing game. By building it I added “capture user input” which I have learned to implement and I want to share it with you briefly.
So here I go:
Grasping the concepts
What is “capture user input”? As the main title suggests, it’s exactly what it says it is. It captures what the user is adding to the input. It might be a password, a name, or whatever the form requires to.
How does it work?
In a simple phrase: it prompts the user for information, and it prints out what the user wrote on it. In other words, it’s like when you receive a call and by answering, on the lines, it gets the sound of your voice.
That’s it!
No, I am not finished. I meant that’s what it does and but I want to add an example as well.
In the below photo, I used the most popular typed “prompt user” that I see almost every day as I want to close a window on Chrome.
Looking at the code and the photos we can see that with “capture inputs” we can manipulate the DOM and as well we can create form validations, mathematical calculations and so much more like the game I create. If you are passionate about logic, which I assume you are, having the fact that you are reading articles about JavaScript, you can give it a try and score against the computer by playing it here.
Until next time, have fun coding.