Prompting and Prodding


Share This Post

Poking and prodding to get the information we want…this is usually something we do with our teenagers, but we can prompt our end users for information by using built in funcionality within JavaScript. The function/method we are going to use is entitled, prompt().

Now one caveat before we dive into this subject…this function is not one I would suggest using often. There are some pitfalls with it, especially when it comes to validation of data. Nevertheless, it is a handy function to know when you want quick feedback. Here is how it works…

[code lang=”js”]
// Create variable to house end user info var userInfo;
// Prompt the user to enter information
userInfo = prompt("Please enter some information.");
// Output the end user’s information to the screen
document.write("You entered: " + userInfo);

So, as you can see from the code above, we can prompt the end user for some information. They can then enter that information. We can store it in a variable and then do what we would like to do with it. Below is what the end user would see when our code runs…


prompt with information

prompt screen display

So, we can quickly and easily gather information from our users. I mentioned previously about some pitfalls with this. I will be honest, I do not use this too often because of the pitfalls. Forms are a better way of gathering the necessary information. Within a prompt, there is not a way to limit or dictate what the end user puts in. It is simply a text box with no parameters. Speaking of being a text box, numbers can be an issue. If you ask an end user to enter a number, that number comes across as a data type of string. So it needs to be converted to an integer using the Number() function.

With all of the issues and trappings that surround the prompt() that limits its usage, it is still a handy, quick little function in certain circumstances.

Happy Coding!

More To Explore


Demystifying Scrum User Stories Confirmation: Ensuring Quality and Collaboration

One of the key elements of Scrum is the use of user stories to define the requirements of a system or feature from the perspective of the end user. As teams work through the product backlog, it becomes crucial to confirm the user stories to ensure they meet the desired criteria and are ready for development. In this blog post, we’ll explore the concept of Scrum user stories confirmation and its significance in delivering high-quality products.


The Power of Conversations in Scrum User Stories

At the heart of Scrum lies the concept of user stories, which serve as a means of capturing requirements from the perspective of end-users. However, the true power of user stories lies not just in their written form but also in the conversations that take place around them. In this blog post, we will explore the significance of conversations in Scrum user stories and how they contribute to the success of Agile projects.

Do You Want To Boost Your Business?

drop us a line and keep in touch

Scroll to Top

Need help?

Let's have a chat...


Jump Back In!

Here at Webolution Designs, we love to learn. This includes sharing things we have learned with you. 


Begin Your Learning Journey Today!

Come back inside to continue your learning journey.