代码语言:javascript复制
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=c6e183994605d131f97132d2f296d713">
</script>
<style>
*{padding: 0px;margin: 0px;}
#container{width:100%; height: 1000px; }
</style>
</head>
<body>
<div id="container">
</div>
<script>
function init()
{
new AMap.Map("container");
}
let callback=init;
callback();
//简单的说起来就是把函数名复赋值给一个变量,然后变量加()就变成了一个函数了.
</script>
</body>
</html>