“ReferenceError não detectado: isso não está definido” no construtor da classe
Estou brincando com o novo material em JavaScript / ES6. Eu recebo umUncaught ReferenceError: this is not defined(...) player.js:5
no meu código Tanto quanto vejo, não há erros aqui! Isso é um inseto? Alguma solução alternativa?
index.html
<html>
<head>
<script type="text/javascript" src="js/entity.js"></script>
<script type="text/javascript" src="js/player.js"></script>
<link href="css/style.css" rel="stylesheet" type="text/css">
<title>Test</title>
</head>
<body>
<canvas id="screen" width=500 height=500></canvas>
<script type="text/javascript">initialize();</script>
</body>
</html>
entity.js
"use strict";
class Entity {
constructor() {
console.log("Entity");
}
}
player.js
"use strict";
class Player extends Entity {
constructor() {
console.log("Created"); // <- error here
}
}