Are you sure your map has been named “map”? Name is case-sensitive. You can rename a map from the map editor (first text input in the top).
Alternatively, you can also get a map by its number: You can try var background = getMap(0);.
var background = getMap(0);