Link to home
Start Free TrialLog 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

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

document.write("Hello World")

HTH,

Kent
Avatar of Manikandan Thiagarajan

ASKER

require js concept hello world program
In your page you include the require script, and specify a main script file to load:

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

Open in new window

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

require(["display"], function(util) {
   sayHello('world');
});

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
StealthyDev

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

http://requirejs.org/docs/jquery.html
ASKER CERTIFIED SOLUTION
Avatar of Göran Andersson
Göran Andersson
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial