Quote:
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>