JavaScript was created by Brendan Eich at Netscape in 1995 and was originally called LiveScript but was renamed JavaScript due to its similarity to the Java programming language. JavaScript code can be written directly in HTML files within <script> tags or can be referenced externally from .js files linked in the <head> section. To write JavaScript, instructions are added with semicolons at the end and code is run in web browsers. The document provides examples of how to prepare and write JavaScript code for use in HTML pages.