I have a question if you can solve. I have this script:
<!DOCTYPE html>
<html>
<head>
<script src="traceur.js" type="text/javascript"></script>
<script src="bootstrap.js" type="text/javascript"></script>
</head>
<body>
<script type="text/traceur">
class Animal {
constructor(name,weight,year) {
this.name = name;
this.weight = weight+"lb";
this.year = year;
}
summary() {
alert(this.name + " " + this.weight + " " + this.year)
}
}
class Cow extends Animal {
constructor(x, y, z, mammal) {
super(x, y, z);
this.mammal = mammal;
}
}
var cow1=new Cow('Luli',176,'09/01/2009',true);
cow1.summary();
</script>
</body>
</html>
I have a question I can´t solve: How I can export the code to a file js and html called from the class Cow like as this:
<!DOCTYPE html>
<html>
<head>
<script src="traceur.js" type="text/javascript"></script>
<script src="bootstrap.js" type="text/javascript"></script>
<script src="class.js" type="text/javascript"></script>
</head>
<body>
<script type="text/traceur">
var cow1=new Cow('Luli',176,'09/01/2009',true);
cow1.summary();
</script>
</body>
</html>
Error Message Uncaught SyntaxError: Unexpected reserved word class.js:1 Uncaught ReferenceError: Cow is not defined
Thank you very much