Is there another way to write a labelled function. I don't understand when we use colon:
check**:** function(element){
let id=element.id.split('');
if(id[id.length-1]==this.questions[this.index].answer){
this.score++;
element.className="correct";
this.scoreCard();
It is not labelled.
Labels are used to navigate loops
What you have is a key in an object and the function is then an object property
const myObject = {
someKey : "someValue",
myObjectFunction: function() {}
};
Alternative
const myObject = {
someKey : "someValue"
};
myObject["myObjectFunction"] = function() {};