For arcgis javascript SDK version 3.x you can use esri/basemaps class to declare and register custom basemaps and use with your map: https://developers.arcgis.com/javascript/3/jsapi/esri.basemaps-amd.html
Declare and register custom basemap:
Basemaps.mybasemap = {
title: 'My custom basemap',
thumbnailUrl: 'https://js.arcgis.com/3.22/esri/images/basemap/satellite.jpg',
//itemId: 'ulas',
baseMapLayers: [
{ url: "https://services.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer" }
]
};
Use custom basemap in map constructor:
var map = new Map("mapDiv", {
basemap: "mybasemap",
center: [-122.69, 45.52],
zoom: 3
});
Or you can apply your custom basemap to existing map:
map.setBasemap("mybasemap");
Full code example: https://codepen.io/digz6666/pen/wPwPbW
For arcgis javascript SDK version 4.x you can use esri/Basemap.
Declare base map layer and base map:
var baseLayer = new MapImageLayer({
url: "https://services.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer"
});
var myBasemap = this.esri.basemap({
baseLayers: [baseLayer],
title: 'My custom basemap',
id: 'my_custom_basemap'
});
Apply basemap to existing map object:
map.basemap = myBasemap;