I am attempting to correlate test scores with values from the level array in order to extract selected values into an output array. However, when I execute the following script in the Firebug console, I encounter the error message "TypeError: level is undefined". This confuses me as I believe that the level variable is properly defined; perhaps the error is originating from a different source.
var level = [[905,990,"91% - 100%","International Professional Proficiency","Able to communicate effectively in any situation"],
[785,900,"79% - 90%","Working Proficiency Plus","Able to satisfy most work requirements with language that is often, but not always, acceptable and effective"],
[605,780,"61% - 78%","Limited Working Proficiency","Able to satisfy most social demands and limited work requirements "],
[405,600,"41% - 60%","Elementary Proficiency Plus","Can initiate and maintain predictable face-to-face conversations and satisfy limited social demands"],
[255,400,"26% - 40%","Elementary Proficiency","Speaker has functional, but limited proficiency. Able to maintain very simple face-to-face conversations on familiar topics"],
[10,50, "0 - 25%","Basic Proficiency","Able to satisfy immediate survival needs"]];
function between(x, min, max) {
return x >= min && x <= max;
}
var newProfic = function profLevel(x, level) {
var prof1, prof2, prof3;
for(var i=0; i<level.length; i++) {
if( between(x, level[i][0], level[i][1])) {
prof1 = levell[i][2];
prof2 = level[i][3];
prof3 = level[i][4];
}
}
return [ prof1, prof2, prof3 ];
}
var profic = newProfic();
var prof1 = profic[0];
var prof2 = profic[1];
var prof3 = profic[2];
newProfic( 300, level);
Any insights or assistance would be greatly appreciated. Thank you