Loading ...
Sorry, an error occurred while loading the content.
 

Re: Spacing Bug

Expand Messages
  • Douglas Crockford
    ... Since you asked, I would write it like this: if (projectItemsIds.hasValue( 123 ) && parseFloat( 2 ) 0 || ````````parseFloat( -2 )
    Message 1 of 6 , Jan 24, 2011
      --- In jslint_com@yahoogroups.com, "abyssoft@..." <abyssoft@...> wrote:
      >
      > Ok my question then is how would
      >
      > if (
      >     projectItemsIds.hasValue(
      >         '123'
      >     ) &&
      >         parseFloat(
      >         "2"
      >     ) > 0 ||
      >         parseFloat(
      >         "-2"
      >     ) < 0
      > ) {
      >

      Since you asked, I would write it like this:


      if (projectItemsIds.hasValue('123') && parseFloat("2") > 0 ||
      ````````parseFloat("-2") < 0) {


      But I should point out that I am not paid by the line.

      In looking at your code, I see a possible error in depending on the precedence rules to make the interaction of && and || right. It is likely that JSLint will soon require more parentheses there.
    Your message has been successfully submitted and would be delivered to recipients shortly.