+ 4

Why I am getting the value at the end 'undefined' .please someone explain

https://code.sololearn.com/WDVYPHd6okI9/?ref=app

15th Oct 2017, 12:40 PM
Arpan Kanwer
24 Answers
+ 4
wait trying
15th Oct 2017, 1:06 PM
Arpan Kanwer
+ 4
ya bro done
15th Oct 2017, 1:07 PM
Arpan Kanwer
+ 3
what do u want to say bro
15th Oct 2017, 12:44 PM
Arpan Kanwer
+ 3
but if I want to alert the user
15th Oct 2017, 12:46 PM
Arpan Kanwer
+ 3
ohk others will answer bro no problem
15th Oct 2017, 12:47 PM
Arpan Kanwer
+ 3
but I want in h1 tag
15th Oct 2017, 12:48 PM
Arpan Kanwer
+ 3
ohk bro
15th Oct 2017, 12:49 PM
Arpan Kanwer
+ 3
means bro
15th Oct 2017, 12:50 PM
Arpan Kanwer
+ 3
trying to put wait
15th Oct 2017, 12:52 PM
Arpan Kanwer
+ 3
u also share your code
15th Oct 2017, 12:52 PM
Arpan Kanwer
+ 3
its correct but I want that when I click button only then it will ask
15th Oct 2017, 12:58 PM
Arpan Kanwer
+ 3
ooohk I got
15th Oct 2017, 1:01 PM
Arpan Kanwer
+ 3
one more question about this that can we ser our default value like when we press ok without putting value its default is 0 but can we set our own
15th Oct 2017, 1:02 PM
Arpan Kanwer
+ 3
is this right now see
15th Oct 2017, 1:08 PM
Arpan Kanwer
+ 3
done
15th Oct 2017, 1:11 PM
Arpan Kanwer
+ 2
alert() function doesn't have any return value, so to put the answer, you must assign variable 'x' to your h1, not the alert return function.
15th Oct 2017, 12:51 PM
$machitgarha
$machitgarha - avatar
15th Oct 2017, 12:54 PM
Arpan Kanwer
+ 2
Just remove this part of your code: window.onload =
15th Oct 2017, 12:59 PM
$machitgarha
$machitgarha - avatar
+ 2
Add the default value as the second argument of the prompt function.
15th Oct 2017, 1:04 PM
$machitgarha
$machitgarha - avatar
+ 2
how bro
15th Oct 2017, 1:04 PM
Arpan Kanwer