0

How we can add two variable whose value is given by user as input?

please give a short code of my problem!

3rd Feb 2017, 1:22 PM
Md.Enam
Md.Enam - avatar
9 odpowiedzi
0
Can u tell by which method has the user inputted the values
3rd Feb 2017, 1:40 PM
Saneem Kahloun
0
use prompt(); function we can ask to input a value to user.
3rd Feb 2017, 1:54 PM
Md.Enam
Md.Enam - avatar
0
use prompt(); function we can ask to input a value to user.
3rd Feb 2017, 1:54 PM
Md.Enam
Md.Enam - avatar
0
I just added it to code play ground its name is " add two numbers" go check it out
3rd Feb 2017, 2:27 PM
Saneem Kahloun
0
or you can find it from my profile
3rd Feb 2017, 2:28 PM
Saneem Kahloun
0
Thank you so much! for help.
3rd Feb 2017, 2:43 PM
Md.Enam
Md.Enam - avatar
0
no problem some likes would be appreciated
3rd Feb 2017, 2:45 PM
Saneem Kahloun
0
You can take advantages of using <input> elements for integrating the user inputs inside your html, instead of using prompt() function, which open a modal 'blocking' window ( all js scripts are stopped, as all display refresh unavailable while user not closing it ), not very user friendly ^^ In addition, instead of basicly document.write() the result, you can rather edit the 'innerHTML' property of an html element, when user click on button to calculate... ... It would give that: https://code.sololearn.com/WzS1Rzioz166/#html
4th Feb 2017, 1:11 PM
visph
visph - avatar
0
you are quite right. I was just trying to keep things simple. Thank
4th Feb 2017, 1:29 PM
Saneem Kahloun