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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -