Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When in doubt, check other bases.</p> <p>2147483648 (base 10) = 0x80000000 (base 16). So it's just making a random number which is within the range of a 32-bit signed <code>int</code>. <code>floor</code> is converting it to an actual int, then <code>toString(36)</code> is converting it to a 36-character alphabet, which is 0-9 (10 characters) plus a-z (26 characters).</p> <p>The end-result of that first line is a string of random numbers and letters. There will be 6 of them (36^6 = 2176782336), but the first one won't be quite as random as the others (won't be late in the alphabet). Edit: Adrian has worked this out properly in his answer; the first letter can be any of the 36 characters, but is slightly less likely to be Z. The other letters have a small bias towards lower values.</p> <p>For question 2, if you mean this <code>a = String(a);</code> then yes, it is ensuring that <code>a</code> is a string. This is also a hint to the compiler so that it can make better optimisations if it's able to convert it to machine code (I don't know if they can for strings though).</p> <p>Edit: OK you clarified the question. <code>f.test(a) &amp;&amp; (...)</code> is a common trick which uses short-circuit evaluation. It's effectively saying <code>if(f.test(a)){...}</code>. Don't use it like that in real code because it makes it less readable (although in some cases it is more readable). If you're wondering about <code>test</code>, it's to do with regular expressions.</p> <p>For question 3, it's new to me too! But see here: <a href="https://stackoverflow.com/q/7452341/1180785">What does `void 0` mean?</a> (quick google search. Turns out it's interesting, but weird)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload