Skip navigation
Currently Being Moderated

How this line works in js (jongware it's from your code)

Apr 27, 2012 9:09 PM

Tags: #javascript

Hi All,

 

I need know how the below line works,See this thread http://forums.adobe.com/message/4364545#4364545

 

q = 0 <= p && (-1 + p + mySearch.length);

 

Green4ever

 
Replies
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 27, 2012 9:14 PM   in reply to Green4ever

    It's confusingly written.

    But you should be able to reason it out yourself!

    What's your question?

     

    Is it more clear if it is written like this?

     

    q = (p >= 0) && (p + mySearch.length -1);
    

     

    or perhaps

     

    if (p < 0) {
      q = false;
    } else {
      q = p + mySearch.length -1;
    }
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points