'How export and import classes in Javascript?
Why isn't working?
index html:
<script src="app.js" type="module"></script>
<script src="cat.js" type="module"></script>
cat.js
export class Cat {
getCat() {
console.log('cat')
}
}
app.js
import {Cat} from "./cat";
let cat = new Cat();
cat.getCat();
I get this error:
Failed to load resource: the server responded with a status of 404 (Not Found)
What can I do?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
