javascript - for loop does not execute twice -
javascript - for loop does not execute twice -
createmodelview: function (obj,vitalslength,headervalue) { for(i = 0, vitalslen = vitalslength; < vitalslen; i++) { // logic } }
two questions
where should place homecoming statement function. if place within loop work.
when phone call function obj.createmodelview(arguments);
why not execute twice or n number of times depending upon vitalslength. it executes once.
some possible issues:
first create sure declare 2 variables before loop
var i=0, vitalslen=0;
and check create sure vitalslength number. can isnan
or typeof
check.
if (isnan(vitalslength)) alert("vitalslength not number");
one of these may or maybe not causing issue, allow me know.
also... can't remember if it's same in javascript it's in other languages, ++i
more efficient utilize i++
.
as 2 questions:
it can set after loop, if want one. hopefully above prepare it javascript
Comments
Post a Comment