JavaScript disappears in advanced action.
Don't know why this is happening, but when I try to execute JavaScript in an advanced action, the JavaScript disappears in the script window before. I've attached the script below (basically assigns random numbers to different variables)
Any help would be appreciated. Thanks
var numArray = [1,2,3];
var numStr
var i = 1;
var arrSize = numArray.length + 2;
while (i<arrSize){
getRandom();
i++;
}
function getRandom() {
var myMax = numArray.length
var myArrRand = Math.floor(Math.random() * (myMax - 0)) + 0; // random place in array to use
var myRand = numArray[myArrRand] // get element from array
var assignedNumber = 'ShowAnsBox' + i;
window.cpAPIInterface.setVariableValue(assignedNumber, myRand);
numArray.splice(myArrRand,1);
}
