repl.txt (1041B)
1 2 {{alias}}( x ) 3 Returns a string giving the literal bit representation of an unsigned 8-bit 4 integer. 5 6 Except for typed arrays, JavaScript does not provide native user support for 7 unsigned 8-bit integers. According to the ECMAScript standard, `number` 8 values correspond to double-precision floating-point numbers. While this 9 function is intended for unsigned 8-bit integers, the function will accept 10 floating-point values and represent the values as if they are unsigned 8-bit 11 integers. Accordingly, care should be taken to ensure that only nonnegative 12 integer values less than `256` (`2^8`) are provided. 13 14 Parameters 15 ---------- 16 x: integer 17 Input value. 18 19 Returns 20 ------- 21 str: string 22 Bit representation. 23 24 Examples 25 -------- 26 > var a = new {{alias:@stdlib/array/uint8}}( [ 1, 4, 9 ] ); 27 > var str = {{alias}}( a[ 0 ] ) 28 '00000001' 29 > str = {{alias}}( a[ 1 ] ) 30 '00000100' 31 > str = {{alias}}( a[ 2 ] ) 32 '00001001' 33 34 See Also 35 -------- 36