equivallent of exit command

Discussion in 'JavaScript' started by jaysa, Mar 11, 2008.

  1. #1
    hai all ,


    anyone knows the command used for exiting from a condition other than window.location......

    waiting for the response from experts
     
    jaysa, Mar 11, 2008 IP
  2. highborn

    highborn Active Member

    Messages:
    184
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #2
    close, return, end, quit. :D
     
    highborn, Mar 11, 2008 IP
  3. vpguy

    vpguy Guest

    Messages:
    275
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    To terminate a function, use return.

    To terminate a loop (for or while), use break.

    Examples:

    function DoIt(val)
    {
        var x = 0;
        while (true)
        {
            x++;
            if (x > 10) { break; }
        }
    
        if (!val) { return; }
    
        // This section will never be reached
        // if val contains a false value
    }
    Code (markup):
     
    vpguy, Mar 12, 2008 IP
  4. jaysa

    jaysa Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thank you all ...
     
    jaysa, Mar 12, 2008 IP