-
-
Notifications
You must be signed in to change notification settings - Fork 226
More low-hanging transformations #794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks Voisin. What's the difference between |
Oops, it's a typo, |
The Random ones are not feasible. The parseInt and parseFloat conversions are actually not such a good idea. Try inputting something invalid and the output is different between the two. |
looks identical do me. |
Try "5a" for example, or try parseInt("5.5") != +"5.5"
…On Tue, Jan 21, 2025, 12:02 Julien Voisin ***@***.***> wrote:
> parseFloat("aaa")
NaN
> +"aaa"
NaN
looks identical do me.
—
Reply to this email directly, view it on GitHub
<#794 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKOGHVJWUTU2PXMRO76XOT2LYSK3AVCNFSM6AAAAABVRBRLX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBUGQYDKMZZG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Damn :< |
Maths
Number(s)
→+[s]
+s
n=n-1
→n--
n=n+1
→n++
n = n ° m
→n°=m
family, with°
being+
,-
,/
,*
and%
ParseFloat(n)
→+n
x!=y
→x^y
ifx
andy
are integers-10
→~9
,-100
→~99
, … and so on :DN00…0
withN
an integer →Ne00…0
Arrays
a.concat()
→[...a]
x[x.length-N]
→x.at(N)
Random
Math.random()<0.5
→new Date&1
, asDate
returns a number ofms
, albeit it might be problematic if called in a super-tight loop.Math.floor(Math.random()*N))
→new Date%N
Misc
while(1)
→for(;;)
The text was updated successfully, but these errors were encountered: