Exact error:
- when converting an object to its numerical form
- unable to convert NaN to a number
I’ve found the segment of code responsible for this, but I’m not sure how to debug it:
var pointA = minForCertainty.getRating();
var pointB = maxForCertainty.getRating();
if ((pointA !== null) && (Number.isNaN(pointA) == false)){
if ((pointB !== null) && (Number.isNaN(pointB) == false)) {
linewidth = pointB - pointA;
lineposition = ((pointA + pointB) / 2);
}
}
thisExp=psychoJS.experiment
if (((endkey.keys !== undefined) && (endkey.keys === “space”))) {
thisExp.addData(‘linewidth’, linewidth)
thisExp.addData(‘lineposition’, lineposition)
}
(in ‘Every Frame’ - initial values of linewidth, lineposition, pointA and pointB have been set in begin experiment & before experiment)
I’ve tried looking through the forum and checking the python to JS cribsheet, but nothing seems to come up. The python version of this code works offline:
pointA = minForCertainty.getRating()
pointB = maxForCertainty.getRating()
if pointB is not None:
if pointA is not None:
linewidth = pointB - pointA
lineposition = (pointA + pointB) / 2
if ‘space’ in endkey.keys:
thisExp.addData(‘linewidth’, linewidth)
thisExp.addData(‘lineposition’, lineposition)
Thank you!