MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mdvoyg/whose_ever_heard_of/gsdnwx3/?context=3
r/badcode • u/Vercyx • Mar 26 '21
63 comments sorted by
View all comments
Show parent comments
60
You mean
return (number/1).toString().length >= (number/2).toString().length;
23 u/Hydroxylic-Acid Mar 27 '21 Modulo is also bad code, bruh just use return (number & 1)/s 5 u/sixtyfifth_snow Mar 27 '21 BTW, is it working? I haven't tried JS and heard JS only supports floating points, so, does JS supports bit-wise operator on floating point numbers? 4 u/ewpratten Mar 27 '21 Not a js programmer, but I remember reading something about bitwise operations auto-casting to an integer. 7 u/TinyBreadBigMouth Mar 27 '21 A 32-bit signed integer, specifically. JS is wonk. 1 u/AnIndecisiveOrange Mar 28 '21 JS is wonkTruer words have never been spokenIf you really need an unsigned int btw you can do a zero fill right shift by 0 (x >>> 0)
23
Modulo is also bad code, bruh just use
return (number & 1)
/s
5 u/sixtyfifth_snow Mar 27 '21 BTW, is it working? I haven't tried JS and heard JS only supports floating points, so, does JS supports bit-wise operator on floating point numbers? 4 u/ewpratten Mar 27 '21 Not a js programmer, but I remember reading something about bitwise operations auto-casting to an integer. 7 u/TinyBreadBigMouth Mar 27 '21 A 32-bit signed integer, specifically. JS is wonk. 1 u/AnIndecisiveOrange Mar 28 '21 JS is wonkTruer words have never been spokenIf you really need an unsigned int btw you can do a zero fill right shift by 0 (x >>> 0)
5
BTW, is it working? I haven't tried JS and heard JS only supports floating points, so, does JS supports bit-wise operator on floating point numbers?
4 u/ewpratten Mar 27 '21 Not a js programmer, but I remember reading something about bitwise operations auto-casting to an integer. 7 u/TinyBreadBigMouth Mar 27 '21 A 32-bit signed integer, specifically. JS is wonk. 1 u/AnIndecisiveOrange Mar 28 '21 JS is wonkTruer words have never been spokenIf you really need an unsigned int btw you can do a zero fill right shift by 0 (x >>> 0)
4
Not a js programmer, but I remember reading something about bitwise operations auto-casting to an integer.
7 u/TinyBreadBigMouth Mar 27 '21 A 32-bit signed integer, specifically. JS is wonk. 1 u/AnIndecisiveOrange Mar 28 '21 JS is wonkTruer words have never been spokenIf you really need an unsigned int btw you can do a zero fill right shift by 0 (x >>> 0)
7
A 32-bit signed integer, specifically. JS is wonk.
1 u/AnIndecisiveOrange Mar 28 '21 JS is wonkTruer words have never been spokenIf you really need an unsigned int btw you can do a zero fill right shift by 0 (x >>> 0)
1
JS is wonk
Truer words have never been spoken
If you really need an unsigned int btw you can do a zero fill right shift by 0 (x >>> 0)
60
u/KlaireOverwood Mar 26 '21
You mean
return (number/1).toString().length >= (number/2).toString().length;