DEV Community

Discussion on: Get all separate digits of a number (TypeScript)

Collapse
 
peerreynders profile image
peerreynders
    function toUint32(x: number) {
        return x >>> 0;
    }

    function toInt32(x: number) {
        return x >> 0;
    }
Enter fullscreen mode Exit fullscreen mode
Collapse
 
amarok24 profile image
Jan Prazak

Thanks! I will update my code because right shift operators are more understandable to people coming from other languages. My solution using the ~~ operator seems to be very JS-specific :-/