Jasa SEO,Jasa Pembuatan Website.
19 January, 2020

Starts With JavaScript

JavaScript is the most Popular programming language over the period of HTML and the Web. JavaScript is very much easy to learn and deploy.Let’s Starts with Javascript.

This tutorial will teach you the JavaScript from beginner to advanced level.

How to starts with JavaScript – Prerequisite

Basic Knowledge of HTML is sufficient to starts with javascript.

 

Writing your First javaScript Program

 

<Script>

console.log('HELLO WORLD');

</script>

 

Javascript is written between the <Script></Script> tags in html file.

 

How many ways to print Hello World

There are various ways to Print Hello word. Some are the following:

 

1. Console.log :

console.log is java script method to print the value in the console.It is very Common Print method in Java script

<Script>

console.log('HELLO WORLD');

</script>

 

Output:

HELLO WORLD

 

2. Inner HTML :

Inner Html method is used to put or change the inner value of html element.

<html>

  <body>

    <p id="html-inner" onclick="change();">Click here</p>

    <Script>

      function change(){

         document.getElementById('html-inner').innerHTML='Hello World';

       }

    </script>

  </body>

</html>

OutPut :

Click here

 3. Append :

Append method is used to Append custom values to your current html attribute.

<html>

  <body>

    <p id="html-inner" onclick="change();">Click here</p>

    <Script>

      function change(){

         document.getElementById('html-inner').append('Hello World');

       }

    </script>

  </body>

</html>

OutPut :

Click hereHello World

Alert:

Last but not least Alert is method to print value to the alert in popup modal. Alert method is basically used to print the crucial information on the webpage to point out the user .

<html>

  <body>

    <p id="html-inner" onclick="change();">Click here</p>

    <Script>

      function change(){

         alert('Hello World');

       }

    </script>

  </body>

</html>

 

These are some techniques to print the values in JavaScript. Hope have learnt something new.

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *