we need 2 things to run the javascript program...
- We need Code editor and -> We are using vs (Visual Studio) Code. VS Code is free to editing code. Vs code is developed by Microsoft developers.
- We need where to see our output? -> We use for output is Chrome. Chrome is developed by Google so it's also free to use ๐ .
These 2 stuff things you already know.
So in this article, we are writing our first javascript program... ๐ฅถ. No Today we are not writing a Hello world... We are writing with Emoji to fun with javascript. Because I'm not thinking you go boring javascript.
Every javascript line end with ;
We are writing two types of javascript code. Internal and external javascript code.
first, we are discussing internal javascript
So now you see in our code. First, we make a simple HTML program, and then after you want to write javascript code. Then you can use <script></script>
.
You can use the <script>
tag inside the <body>
tag Or <head>
tag
Secondly, External javascript use.
Index.html
Now you can see the first Index.html we are linked with the external script.
<script src="./script.js"></script>
.
SRC is an attribute of the script tag. Using src you can connect with an external javascript program. And seconde file call script.js in this file we write simple code...!
Now, How do I see my output in the browser.?
If you are using Chrome, Firefox, Or any other browser the way is always one.
Open Chrome browser -> clicks on white background -> Go to Inspect
This is a long process to see our output ๐คฃ
Click F12
to directly open the console in your browser... ๐...
What is console.log()?
The console.log() is a function in JavaScript that is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user.
We discuss more Console.log() in the next chapter...
Thank you for reading ๐
Top comments (2)
Great explanation Kuldeep!
but how can I make pictures like the visual aids you are using(The attached picture)?
Thanks in advance
Hello @hameed This is making with VS code plugin.