0% found this document useful (0 votes)
2 views

JS Code Example

The document provides a simple JavaScript program that prints 'Hello, World!' to the console. It also includes a function that adds two numbers and logs the result. The code is self-contained and can be executed in any JavaScript environment.

Uploaded by

elmahboubimehdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

JS Code Example

The document provides a simple JavaScript program that prints 'Hello, World!' to the console. It also includes a function that adds two numbers and logs the result. The code is self-contained and can be executed in any JavaScript environment.

Uploaded by

elmahboubimehdi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ChatGPT

write a small complete javascript code that can be


compiled

Here's a simple JavaScript program that prints "Hello, World!" to the console. It is
self-contained and can be run in any JavaScript environment.
javascript Copy Edit
console.log("Hello, World!");

If you want something a bit more interactive, here's a simple function that adds two
numbers and logs the result:
javascript Copy Edit
function add(a, b) {
return a + b;
}

let result = add(5, 3);


console.log("The sum is:", result);

This code defines a function add() that takes two numbers, returns their sum, and
logs the result. Let me know if you need something more advanced! 🚀

You’ve hit the Free plan limit for GPT-4o.


Responses will use another model until your limit resets in 20 minutes.
Get Plus

Ask anything
Search Reason
ChatGPT can make mistakes. Check important info. ?

You might also like