javascript - How to stop an if statement when it's always true? -
if (userarray[0] === 1 ) { cardmaker(); return false; }
i have array want call function cardmaker when first value array 1. problem above code keeps calling function on , over. tried return false doesn't seem work. how can function invoke once when first value of array 1?
try
var cnt = 1;// put line out side of function if (userarray[0] === 1 && cnt == 1) { cardmaker(); cnt++; return false; }
Comments
Post a Comment