How to Print ‘Hello World’ Using a Function in JavaScript

please click here for more wordpress cource

Sure, here’s a simple function in JavaScript that prints ‘Hello World’ to the console:

function sayHello() {
  console.log('Hello World');
}

// call the function to print 'Hello World' to the console
sayHello();

When you run this code in a JavaScript environment like a web browser console or Node.js, it will output ‘Hello World’ to the console.

You may also like...

Popular Posts

Leave a Reply

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