JavaScript has many capabilities, but there are also limitations to what it can do. Some of the main things JavaScript cannot do are:
Write to files on the server: JavaScript runs in the browser, so it cannot directly write to files on the server. It needs a server-side script to do that.
It can't write data permanently to an existing file. For example, you can't take data from the guest book and add it to a page that displays the messages.
It can't access file on the server.
It can't glean any information about the user, including email or IP addresses.
It can't create multiplayer games.
It can't submit credit card-based purchases for authorization and payment.
It can't get data directly from a server database.
It can't handle file upload.
Read from or write to files on the client: For security reasons, JavaScript does not have access to the client file system. It can only access cookies and other web storage APIs.
Access web pages on other domains: The same-origin policy restricts how JavaScript can interact with resources from other origins. It cannot access data from another domain.
Protect your page source or images: Once a web page and its resources are downloaded, the user already has a copy. JavaScript cannot encrypt the page to hide its source code from the user.
Close a window it did not open: JavaScript can only close windows that it opened itself. It cannot close any browser window for security reasons.
Run after the page has unloaded: Once the page has unloaded, all JavaScript execution stops. It cannot run in the background.
Conclusion-
In summary, JavaScript is restricted in what it can access and do for security reasons. While it is a powerful language, there are limitations put in place by the browser to prevent malicious behaviour. Hopefully, this gives you a good overview of some of the main things JavaScript cannot do! Let me know if you have any other questions.
If you like the information then follow and subscribe to my newsletter.
Thank you