Exponent...?

When trying to raise something, I tried text.setText('5\^8'); and that didn’t raise the 8, I tried something like 4^3, that didn’t raise the 4 to the third power or give me the right answer. I even tried “**” to raise something to an exponent, and tried adding parenthesis as well. idk if the symbols that I’m using are wrong, but is there a powerful symbol to raise a number to an exponent?

EX:

2^4 = 2x2x2x2 = 16

i’ve never heard of anything in raw text that makes a superscript

Superscript is possible… but I get weird results in the editor.

For example, type this:

text.setText('5'.sup('7'));

And then press play, and the text will be set to a raw html of a superscript… why html?

And Idek why it’s not working!

This is what I’m looking for:
123456789101112

it’s html because javascript was made to be used with html. also javascript strings don’t support any type of text formatting including superscripts.

Oh! That makes more sense, thanks for letting me know!

But, is it possible to have the value of something set to an equation with a exponent?

I guess you could make another text object that is smaller and higher than the base text object to put for the superscript

1 Like

Math.pow(x, y) is x to the y power. Hope this helps.

2 Likes

Thank you Baron, it works perfectly :D

1 Like

They need quotes so JavaScript recognizes them as a string so the sup function can be used. I don’t think there is a sup function for numbers.