Program to convert KiloBytes to Bytes and Bits | Function to calculates the bits ; Calculates Bits 1 kilobytes ( s ) = 8192 bits ; Function to calculates the bytes ; Calculates Bytes 1 KB = 1024 bytes ; Driver code
function Bits ( kilobytes ) { var Bits = 0 ; Bits = kilobytes * 8192 ; return Bits ; } function Bytes ( kilobytes ) { var Bytes = 0 ; Bytes = kilobytes * 1024 ; return Bytes ; } var kilobytes = 1 ; document . write ( kilobytes + " " + Bytes ( kilobytes ) + " " + Bits ( kilobytes ) + " " ) ;