Avatar of Manikandan Thiagarajan
Manikandan Thiagarajan
Flag for India asked on

could you give me the hello world program for require.js

could you give me the hello world program for require.js

i want to understand he require.js

Avatar of undefined
Last Comment
Göran Andersson

8/22/2022 - Mon
Kent Dyer

Ref.. http://www.w3schools.com/jsref/met_doc_write.asp

document.write("Hello World")


Manikandan Thiagarajan

require js concept hello world program
Göran Andersson

In your page you include the require script, and specify a main script file to load:

<!DOCTYPE html>
        <title>My Sample Project</title>
        <script data-main="main" src="scripts/require.js"></script>
        <h1>My Sample Project</h1>

Open in new window

In your main.js file you load other scripts, for example a display.js file:

require(["display"], function(util) {

Open in new window

The display.js file containing a function used in the main.js file:

function sayHello(name) {
  alert('Hello ' + name);

Open in new window

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Manikandan Thiagarajan

cold you please give me the main.js file
Manikandan Thiagarajan

i am the new to the require.js

give me the full helloworld program to understand the require.js

and also specify the advantage
Manikandan Thiagarajan

can u zip it and send the file
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Hey stmani, nothing other than this could help you :)

Göran Andersson

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question