Javascript Core Usage

Javascript Core Usage

Javascript can be used in browser and non-browser environment. In the non-browser environment, it can be used in server-side scripting for making even more complex system.

It also can be used in desktop and mobile application development. For example, Adobe Acrobat Reader uses JavaScript code.

But the core usage of JavaScript is to develop interactive webpages. That’s why all the modern browsers come with dedicated Javascript engine supported.

This whole tutorial mainly covers, how to use Javascript to make complex web applications or client-side Javascript. We also cover some server-side uses of JavaScript.

If you want to learn JavaScript server-side scripting then Learn JavaScript with Node.JS.

Node.JS Tutorial

Highly recommended: Learn JavaScript first before learning Node.JS

JavaScript in Web

We already know that JavaScript can be directly run by web browser with HTML and CSS. Now before driving into Javascript, let’s see an example of how JavaScript works in the web browser along with HTML and CSS.

<!DOCTYPE html>
  <html>
    <head>
    <script>
      function testFunction() {
        document.getElementById("example1").innerHTML = "Paragraph changed.";
      }
    </script>
    </head>
  <body>

    <h6>JavaScript can be placed in head</h6>

    <p id="example1">Click the button to change text</p>

    <button type="button" onclick="testFunction()">Click me!</button>

  </body>
</html> 

This code shows a simple paragraph. And we have also added a button using <button> tag.

Click the button to change text


Click on the button to see the JavaScript behavior of above code.

*Javascript can change static page’s text or other content for an event without reloading the page. We will learn more about Javascript event in the later chapters.

For now, don’t worry about how the code worked. In the subsequent chapters, we will learn all the things.

« Previous Next »