logo CBCE Skill INDIA

Welcome to CBCE Skill INDIA. An ISO 9001:2015 Certified Autonomous Body | Best Quality Computer and Skills Training Provider Organization. Established Under Indian Trust Act 1882, Govt. of India. Identity No. - IV-190200628, and registered under NITI Aayog Govt. of India. Identity No. - WB/2023/0344555. Also registered under Ministry of Micro, Small & Medium Enterprises - MSME (Govt. of India). Registration Number - UDYAM-WB-06-0031863

How to write hello in JavaScript?


How to write Hello in JavaScript
 

In JavaScript, you can display "Hello" in various ways. Here are a few common methods:

 

  1. Using console.log():

    If you're working in a JavaScript environment that supports the console (like a browser's developer console or Node.js), you can use console.log() to output "Hello" to the console:

    console.log("Hello");
  2. Using alert():

    In a browser environment, you can use the alert() function to display a dialog box with the text "Hello":

    alert("Hello");
  3. Writing to HTML:

    If you want to display "Hello" within an HTML page, you can use JavaScript to manipulate the HTML content. For instance, if you have an element with the ID "output":

    HTML:

    <div id="output"></div>

     

     

    JavaScript:

    document.getElementById("output").innerHTML = "Hello";

 

Each of these methods can be used in different contexts based on the specific requirements of your JavaScript application or development environment.

 

Thank you.

Popular Post:

Give us your feedback!

Your email address will not be published. Required fields are marked *
0 Comments Write Comment