The web page must display a button. When a user clicks on the button, a prompt should show up, asking the user to enter any number. Upon entering the number, an alert should then show up with a message such as: 'The 5th power of "x" (x being the user's entered number) is "y" (with y being the result). In other words, the 5th power of a user's random entered number must be computed. How is this coded? This is the actual instruction: 'Create an HTML document and link a JavaScript file to the document in the document header. Write a function getAndShow() in the JavaScript file that will use a prompt dialog to ask the user for any number. Use the number returned by the prompt to compute the fifth power of that number and display it in a message box with a suitable message.'. There's also mention of a getAndShow() function that has to be added to the js file. Lastly, the images in the original questions are guidelines on what the code must produce.
The web page must display a button. When a user clicks on the button, a prompt should show up, asking the user to enter any number. Upon entering the number, an alert should then show up with a message such as: 'The 5th power of "x" (x being the user's entered number) is "y" (with y being the result). In other words, the 5th power of a user's random entered number must be computed. How is this coded?
This is the actual instruction: 'Create an HTML document and link a JavaScript file to the document in the document header. Write a function getAndShow() in the JavaScript file that will use a prompt dialog to ask the user for any number. Use the number returned by the prompt to compute the fifth power of that number and display it in a message box with a suitable message.'.
There's also mention of a getAndShow() function that has to be added to the js file.
Lastly, the images in the original questions are guidelines on what the code must produce.
Step by step
Solved in 4 steps with 4 images