0

This seems fine to me but I wanted to know if it is ok to have two capital letters in a roll ("AF" in the case below).

let isScoreAFloat = score % 1 !== 0;

If this name is not the best, what name would better convey the possible result of the operation?

Thanks.

Gabriel Ferraz
  • 592
  • 6
  • 26
  • check this out: http://stackoverflow.com/questions/921133/javascript-naming-conventions – intelis May 14 '16 at 21:36
  • Perhaps if you are really just validating the number, `isScoreValid`. – Jacob Brazeal May 14 '16 at 21:39
  • you do not need to follow the grammar, `isScoreFloat` sounds good to me. – skobaljic May 14 '16 at 21:40
  • 1
    Well, as another developer I can clearly understand that this variable meaning is `there is a score and is it a float?`. then yea it does the job... – Daniel Krom May 14 '16 at 21:40
  • 1
    http://codereview.stackexchange.com/ – Dan Prince May 14 '16 at 21:45
  • 1
    All JS numbers are 64 bit floats. I would use `!Number.isInteger(score)`, which is self explanatory. – Oriol May 14 '16 at 21:45
  • If you were talking about a method, I'd use `isScoreAFloat`. As a result, I'd use `scoreIsAFloat` or just `scoreIsFloat`, because IMO it reads better as a condition. `if (scoreIsAFloat) {...` –  May 14 '16 at 21:58

1 Answers1

1

There is nothing wrong with that variable name, it clearly explains what it holds. Clarity is the most important thing in naming. The variable name is not ambiguous! If you're asking if the name is valid camel case, the answer to this is also yes.

sheeldotme
  • 2,237
  • 14
  • 27