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

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -