Convert exponential notation of number (e+) to 10^ in JavaScript

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());

167 thoughts on “Convert exponential notation of number (e+) to 10^ in JavaScript”

  1. What i do not realize is in reality how you are no longer really a lot more smartly-favored than you may be right now. You are very intelligent. You recognize therefore significantly relating to this subject, produced me in my view consider it from numerous numerous angles. Its like men and women don’t seem to be interested unless it’s something to accomplish with Girl gaga! Your personal stuffs excellent. At all times care for it up!

    Reply
  2. Thank you for sharing excellent informations. Your web site is so cool. I’m impressed by the details that you¦ve on this blog. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for extra articles. You, my friend, ROCK! I found just the info I already searched everywhere and simply could not come across. What an ideal web-site.

    Reply
  3. certainly like your website but you have to test the spelling on quite a few of your posts.
    A number of them are rife with spelling issues and I find it very troublesome to tell the reality however I will certainly come again again.

    Reply
  4. I’m really inspired with your writing abilities and also with the layout to
    your blog. Is that this a paid topic or did you modify it your self?
    Anyway stay up the nice high quality writing, it is uncommon to see
    a nice blog like this one these days..

    Reply
  5. First of all I would like to say excellent blog!
    I had a quick question that I’d like to ask if you do not mind.
    I was interested to find out how you center yourself and clear
    your mind before writing. I have had a hard time clearing my thoughts in getting my ideas out.
    I do enjoy writing but it just seems like the first 10 to 15
    minutes are generally lost just trying to figure out how
    to begin. Any recommendations or tips? Kudos!

    Reply
  6. Pretty great post. I simply stumbled upon your blog and wished to mention that I have truly loved surfing around your weblog posts.

    In any case I will be subscribing on your feed and I’m hoping you write once more soon!

    Reply
  7. My spouse and I stumbled over here by a different web page and thought I should check
    things out. I like what I see so i am just following you.
    Look forward to looking into your web page again.

    Reply
  8. naturally like your website however you need to take a look at the spelling on quite a few of your posts. A number of them are rife with spelling issues and I find it very troublesome to tell the truth however I?¦ll surely come again again.

    Reply
  9. An interesting discussion is value comment. I think that you should write extra on this subject, it won’t be a taboo topic but generally persons are not enough to talk on such topics. To the next. Cheers

    Reply
  10. [url=https://silagra.guru/]buy silagra online uk[/url] [url=https://viagractab.monster/]viagra online india pharmacy[/url] [url=https://cialisitab.quest/]cost of cialis generic[/url] [url=https://neurontina.online/]gabapentin 300 mg price in india[/url] [url=https://celebrex.guru/]celebrex medication cost[/url] [url=https://buysuhagra.store/]suhagra 25 mg[/url] [url=https://suhagra.store/]suhagra 50 online[/url] [url=https://buyprednisolone.boutique/]cheap prednisolone tablets[/url]

    Reply

Leave a Comment