en.javascript.info
en.javascript.info copied to clipboard
First example in "Prompt" has syntax errors
See: https://javascript.info/alert-prompt-confirm#prompt
result = prompt(title[, default]);
Should be:
result = prompt(title, default);
Unless I am missing something.
@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 Oh interesting. I had not seen that before. Closing.