Remove null value from a number array
Hello,
I created a number array as follows:
Qualtrics.SurveyEngine.addOnReady(function()
{
var i1=parseInt("${q://QID1/ChoiceTextEntryValue}");
var i2=parseInt("${q://QID2/ChoiceTextEntryValue}");
var i3=parseInt("${q://QID3/ChoiceTextEntryValue}");
var myArray = [i1, i2, i3];
And I want to randomly select one of these items in the array, so I write:
var randomItem = myArray[Math.floor(Math.random() * myArray.length)];
But the problem is, if one of the three items is null (a respondent skill the question), this does not work.
Could you please tell me how I can remove null item in the array?
Thank you very much.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
