Is the variable announced or not?



  • How's the javascript setting out the variable or not?

    For example:

    if(!tmp){
        var tmp=$("<div />");
        tmp.dialog();
    }else{
        if(!tmp.dialog("isOpen")) tmp.dialog("open");
    }
    

    and we need tmp to be global so that we don't create a dialogue window every time. ♪ ♪

    Please.



  • To see if the variable is defined, use a typeof comparison with "undefined"

    if(typeof tmp !== "undefined"){
        // Определена
    }
    else{
        // Не определена
    }
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2