javascript - jscript if for global variable -
here's code
var isnew = true function limb(a,b) { if (isnew=true) { post(a,b); isnew = false; post ("first"); } else { post(a,b); post ("not first"); } }
the problem i'm having else
condition never triggered. i'm assuming value of isnew
never updated, have no idea why.
in languages =
used both assign values , compare them. javascript uses different operators each of these.
x = 10
means "set x
10
, , give me value of x
".
x == 10
means "tell me if x
equal 10
".
so condition have been if(isnew == true)
, have worked. can put if(isnew)
.
Comments
Post a Comment