JavaScript code in External file

Click the button to get the alert.

Note: In this Demo we can not keep the JavaScript code in the external file, so we are keeping the JavaScript code in HTML page itself.
You can try by keeping the script code in external JavaScript file in Visual Studio.