+ 1

What is the result if I press ok in a prompt without writing anything ?

Javascript question

4th Sep 2020, 10:32 AM
RichardB
RichardB - avatar
5 Respuestas
+ 3
🔫 Rick Grimes I think it returns null if you press cancel, although this behaviour varies for browsers, like safari, it sometimes returns empty string as well for Esc or cancel the prompt
4th Sep 2020, 10:40 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 2
null.
4th Sep 2020, 10:36 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Oh yes m8 Мг. Кнап🌠 I was confused a little on cancel and ok.
4th Sep 2020, 10:43 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Thank you guys
4th Sep 2020, 10:44 AM
RichardB
RichardB - avatar
+ 1
You won't get anything, just empty string, since prompt on press of ok returns the value passed to it.
4th Sep 2020, 10:36 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar