JavaScript Tutorial

Introduction to JavaScript

JavaScript don’t need any introduction. JavaScript is on the top 0f popularity list in the planet earth 🙂 !

If you ever got impressed by any site, and you feel that the site is very interactive. Behind the scene, JavaScript is actually making it possible.

Now you will think is JavaScript just useful for Websites ? And I will answer NO! With  JavaScript, you can make games, Desktop applications, Mobile apps, Data handling and much more is possible with JavaScript.

You can create both server-side and client-site programs with fundamental knowledge of JavaScript.

Welcome to JavaScript


FAQ

Question

Chose the correct option

  1. JavaScript is for client-site programming only
  2. With JavaScript, you can create interactive website
  3. You can only use JavaScript for Websites
Answer

2. With JavaScript, you can create interactive website


How to use JavaScript?

Thinking how you can use JavaScript in your webpage? You can put JavaScript tag anywhere in your Webpage’s HTML code. To use JavaScript in your webpage’s HTML code, use <script> and </script> tag.

<script>
    ....
</Script>

FAQ

Question

Chose to correct tag needed to enclose the JavaScript code?

  1. <html> ... </html>
  2. <body> ... </body>
  3. <code> ... </code>
  4. <script> ... </script>
  5. <style> ... </style>
Answer
2. <script> ... </script>

You want to test this example code ?

Well, it’s really easy at ITC! Simply click this “ITC Tryit” editor,  and see the code and result side by side.


FAQ

Question

Chose the correct option to fill in the blanks

<script>
            ________.____("Hello World!");
</script>

Options:  1. out    2.  print     3. document    4. write

Answer
<script>
          document.write("Hello World!");
</script>

JavaScript console function

Now, we know how to write a java code in HTML to get output with document.write(“”):
Let’s learn how to use another type of output, and this is browser console output.

The console is a web browsers part that allows us to show messages. We will use console.log() JavaScript function to show a message.

You want to see an example code ?

Simply click this ITC Tryit editor,  and see the code and result side by side.


FAQ

Question

Complete the code

<script>
________.______("Hello world!");
</script>

 

Answer
<script>
console.log("Hello world!");
</script>

congratulations! You have successfully completed this lesson