Table of contents
With a renewed drive, I have restarted learning JavaScript referring once again from the JavaScript updated course by Vinod Bahadur Thapa, founder of Technical Thapa YouTube channel. I love his in-depth teaching, a completely hands-on course, covering every possible aspect of the topic at hand. Learning from Vinod Sir, I am presenting my understanding & explanations, which will benefit You, Dear Reader.
Here is Vinod Sir’s latest JavaScript source code on Github.
Let us focus on understanding concepts, implementing working functionality and not get engrossed in too much overthinking. Always focus on hands on learning, making as many mistakes freely.
Key Points
A Brief History
Originally called as Mocha by Brendan Eich, 1995, this web programming language was known as LiveScript before it’s final release as JavaScript. However it has nothing to do with Java, whose name was actually harnessed for LiveScript to publicize as JavaScript. After submission to ECMA International for standardization, in 1997, it became ECMAScript. Thereafter, post 2015, we saw annual releases of ECMAScript in each year, with updates and/or deprecations.
How to run a JavaScript program?
Drawing from my experience, JavaScript code can be written and executed in the following ways:
By internal and external usage of JavaScript code in HTML files.
internal - when a block of JavaScript code is written inside a HTML file, within the
<script>javascript code here</script>
tag.external - when a block of JavaScript code is written outside a HTML file and inside a new JavaScript file (“file_name.js”) but is used within the HTML file using src attribute of
<script src="file_name.js">NO JAVASCRIPT CODE HERE</script>
tag.then installing the Live Server extension by Ritwick Dey inside Visual Studio Code → clicking on Go Live at the bottom right corner of the status bar → this will open your web browser, where You will see the result of the JavaScript code either on the screen or inside the Inspect pane.
Creating only a JavaScript file “file_name.js” -> installing node.js from our command line and using it inside an IDE terminal by typing
node file_name.js
and hitting enter. This will run our JavaScript code inside the IDE.Through various available online code editors and compilers.
I will illustrate all the ways of working for You below, one by one.
- Using Internal JavaScript inside a HTML file and running the Live Server.
As the browser opens (I prefer Google Chrome but Edge opened 😅, so I took the snapshot there to show You the working), right click on the screen and click Inspect or press Ctrl+Shift+I.
Then on the pane that appears (in my case, it is docked below based on a recent need, in most cases, it will be docked to the right) → click on Console → below You will see Your output!
Using External JavaScript outside a HTML file, in a separate JavaScript file and then running the Live Server, same as before, keeping the HTML file as the active tab, giving the same output.
Press Ctrl+Shift+` to open the terminal in Visual Studio Code → type node file_name.js to run the JavaScript file directly within the platform.
- Google searching online JavaScript editors/compilers will give You many online platforms to run JavaScript files. Even Visual Studio Code now has its installation-free web version.
Conclusion
That was it for this blog post. Meet you again with new content on the next one.
😄Please do visit the links below to enjoy my body of works: