Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## Exponent numeric display.

Hello, I would like to apologize in advance for the somewhat weird english I'm going to write.

The problem is as follows, I need to make a program in javascript that creates a random monomial and then you have to solve it.

My isse is, how can I make the exponent look like the normal small number, for example:

This is how my exercise is shown: -18x2 when x is -54

I want it to show it like this: -18x˛ when x is -54

Any help would be greatly appreciated.

2. Code:
`-18x<sup>2</sup>`
?

3. Originally Posted by abduraooft
Code:
`-18x<sup>2</sup>`
?
What I'm trying to use to convert is ("x" + Monomio.grado) where Monomio.grado is my exponent, but using <sup> or .sup doesnt appear to change anything.

Sorry for the rather stupid question...

4. Code:
```var str = "-18x"
var exponent = "2";
var x = str + exponent.sup();
document.write(x);```

“The expert at anything was once a beginner”

5. Originally Posted by Philip M
Code:
```var str = "-18x"
var exponent = "2";
var x = str + exponent.sup();
document.write(x);```

“The expert at anything was once a beginner”
If I use an associative array should it work like this?

(monomial.exponent).sup

6. Originally Posted by Kiefer
If I use an associative array should it work like this?

(monomial.exponent).sup
I do not have the faintest idea what your question is. But I do not see how associative arrays come into it.
sup() is an inbuilt Javascript method which is used to display a string as superscript text. My example shows how to apply that to the exponent (i.e. squared).

You can use the split() method to divide a number with exponent into its parts-

Code:
```<script type = "text/javascript">

var string = "-18x12";  // minus 18 raised to the power of 12
var ssplit = string.split("x");
var str = ssplit[0] + "x";
var exponent = ssplit[1];
var x = str + exponent.sup();
document.write(x);

</script>```

7. I think he just misused terminology, Philip.

I think he has an object, referenced by the variable monomiial (or maybe Monomio--he uses different names in different posts) and that object has a property named exponent (or maybe grado--again, different names in different posts).

SO I think the answer is "yes".

I think if he simply uses `monomial.exponent.sup()` (or maybe it is `Monomio.grado.sup()`??) it will work.

It will not work as he showed it: (monomial.exponent).sup because he omitted the () after sup.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•