UPDATED: I have a conditional statement that is dependant on the time a user clicks during a video playing. The result of their response is either too early, correct or too late and is displayed at the end of the video. How can I add in another result option for if the user doesn't click before the video ends? In this case, not clicking is a different response to clicking too late.
Currently I have working...
// get result based on time of click
$('#response').on('click', function() {
var response-time = myVid.currentTime;
var result;
if (response-time < 5) {
result = "too early" ;
} else if (response-time < 10) {
result = "correct" ;
} else {
result = "too late" ;
}
I tried adding console.log(result) to see if there is a null or undefined 'result' when there is no click before the video ends so I can maybe add another if statement based on the log response. But adding console.log interrupts the next on ended function because there is never a chance to log "result" if there is no click during the video.
I also tried an additional if statements using a variety of combinations for result being anything other than those listed above but with no success. This seems so logical to me but it doesn't work.
var finalResult
if (result != "too early" && result != "correct" && result != "too late") {
finalResult = "you did not click"
}
I feel like I'm going round in circles with this one so any help is welcome