Link to home
Create AccountLog in
Avatar of Manikandan Thiagarajan
Manikandan ThiagarajanFlag 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 Kent Dyer
Kent Dyer
Flag of United States of America image


document.write("Hello World")


Avatar of Manikandan Thiagarajan


require js concept hello world program
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

cold you please give me the main.js file
i am the new to the require.js

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

and also specify the advantage
can u zip it and send the file
Avatar of StealthyDev

Hey stmani, nothing other than this could help you :)
Avatar of Göran Andersson
Göran Andersson
Flag of Sweden image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account