I have a script, where I can convert gigs to megs to kilobytes to bytes to bits.
After that it uses the .toExponential
function to turn it into scientific notation.
But I want it to change into an exponent, instead of it being +e#
I want it to be ^#
, any way I can change it to print that way instead, if not, anyway I can alter the string to change +e
to ^
?
Code:
console.log('calculator');
const gigabytes = 192;
console.log(`gigabytes equals ${gigabytes}`);
var megabytes = gigabytes * 1000;
console.log(`megabytes = ${megabytes}`);
var kilabytes = megabytes * 1000;
console.log (`kilabytes = ${kilabytes}`);
bytes = kilabytes * 1000;
console.log(`bytes = ${bytes}`);
bites = bytes * 8;
console.log(`bites are equal to ${bites}`);
console.log (bites.toExponential());