Google says this is a move to improve security. You’ll still be able to use Google Drive to share such files.
You will no longer be able to send javascript files on Gmail from February 13, 2017 onwards. Google announced today, that as a security measure, the company will no longer allow javascript files to be shared via Gmail. You can, however, still upload such files to Google Drive or other cloud services and share them with others. Google says that the move is an effort at user security and whenever you try to attach such files, post February 13, Gmail will not allow you to attach them, giving you the reason for why it is so.
Gmail already blocks files with .exe and some other extensions. The new move means files with .js extensions will also be blocked from sharing. For the uninitiated, even extensions like .msc and .bat are blocked from being shared as attachments on Google.
On the one hand, this may be cumbersome for some users. On the other, it does help in improving security on attachments. Attackers do not usually share Google Drive files and infecting a computer is easier with files with .exe and .js extensions.