I am using javascript classes and ran into the SCRIPT1002 issue in IE 11, where IE is unable to interpret the 'class' keyword that is available in es6. I have been reading that using babel is a way to work around this unfortunate issue. However, I am having issues understanding how to properly do this. below is my code. What do I need to add to allow IE 11 to properly interpret a js class?
header including babel.js (browser.js is being loaded properly)
<!-- babel -->
<script type="text/babel" src="<?php echo $GLOBALS["COMMON_ROOT"]; ?>/scripts/babel-5.8.29/browser.js"></script>
class in javascript file casuing the SCRIPT 1002 error
class assessmentAnswer {
constructor(answerID, questionID, answerText, imagePath) {
this._answerID = answerID;
this._questionID = questionID;
this._answerText = answerText;
this._imagePath = imagePath;
}
getAnswerID(){
return this._answerID;
}
getQuestionID(){
return this._questionID;
}
getAnswerText(){
return this._answerText;
}
getImagePath(){
return this._imagePath;
}
getAll(){
return this.getAnswerID()+","+this.getQuestionID()+","+this.getAnswerText()+","+this.getImagePath();
}
}
This code runs fine in Firefox.