这是我的index.html
:
<!DOCTYPE html>
<html lang='ru'>
<head>
<meta charset='utf-8'/>
<title>Sandbox</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js'></script>
<script src='js/index.js' type='text/babel'></script>
</head>
<body>
<div id='foo'></div>
</body>
</html>
这是我的js/index.js
文件:
"use strict";
window.onload = function(){
const stuff = () => document.getElementById('foo').textContent = 'Hello!'
stuff()
}
打开HTML文件时,我在Google Chrome v64.0.3282.140中收到错误消息:
为什么会这样?