You'll need to follow the preceding process we described for every application that you build with the ArcGIS API for JavaScript.
The creation of the map can only happen when your HTML has finished loading, and all the required DOM elements and scripts are ready. You achieved this by using the domReady! plugin in your require() function. This ensured that the code in the function that was passed as the second argument only executes when everything is in place. This function is known as an initialization function:
require(["esri/map", "dojo/domReady!"], function(Map) {
// initialization goes here
});
You use your initialization function to create your map, add layers, and perform any other setup routines necessary to start your application.
Creating a map is invariably one of the first things that you'll do and in this section we...