en.javascript.info icon indicating copy to clipboard operation
en.javascript.info copied to clipboard

First example in "Prompt" has syntax errors

Open mikegee0101 opened this issue 8 years ago • 2 comments

See: https://javascript.info/alert-prompt-confirm#prompt

result = prompt(title[, default]);

Should be:

result = prompt(title, default);

Unless I am missing something.

mikegee0101 avatar Apr 16 '18 05:04 mikegee0101

@mikegowen It is not a syntax error. square bracket means the argument is optional. For prompt only title is required and default is optional. For example, both of this will work let result = prompt('Your Name?'); let result1= prompt('Your Name?', 'Anonymous');

venkatraj avatar Apr 24 '18 02:04 venkatraj

@venkatraj Oh interesting. I had not seen that before. Closing.

mikegee0101 avatar Apr 24 '18 04:04 mikegee0101