• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

Style issue

I want to write x to be squared, ie x2 but the 2 is to the power of x.
how do i get the 2 like that??

0
Alk
Asked:
Alk
  • 2
1 Solution
 
reubenbellCommented:
I dont get it do you mean.

<script>
var x = 2;
document.write("square of x: " + parseFloat((x * x)))

var y = Math.pow(x, 2);
document.write("y = xpower of 2: " + y)

//i think you might want this
var pow = 3; //power of newx
var newx = 5;

var curnum = newx;
for (var i=0;i<(pow+1);i++){
   curnum = curnum * curnum;
}
document.write(newx + " to the power of " + pow + " is " + curnum)
</script>
0
 
IndurainCommented:
Alk,

You can use the <sup> tag

e.g., x<sup>2</sup>  should produce the desired result.

Hope this helps.

0
 
reubenbellCommented:
lol, thats what he ****ing meant.

sorry,
!!!
RB

(should have got points for effort tho, hehe)
0
 
AlkAuthor Commented:
Excellent
Sorry for the confusion!!
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now