I have the following function in my JavaScript code and when I run it shows me the following error Cannot read property 'toString' of undefined
I am developing an SharePoing web application.
function startTest(quizID) {
currentQuizItem = quizList.getItemById(quizID);
var quizName;
context.load(currentQuizItem);
var userName = user.get_title();
var audiencenames = currentQuizItem.get_fieldValues()["Audienca"];
var straudience = audiencenames.toString();
straudience = straudience.toUpperCase();
straudience = straudience.replace(/\s/g, '');
userName = userName.toUpperCase();
userName = userName.replace(/\s/g, '');
var rezultati = straudience.match(userName);
alert(rezultati);
}
please help me!