Superscript in code

Hello, i just want to ask how to assign a superscript text in a variable. Im trying to use .sup() method of javascript but it displays literally '<sup>2</sup>'.

i want to do something like this. But it wont work.

togchangeax(){
    if (this.axis==true){
      this.formula = '(x-h)'+'2'.sup()+' = 4c(y-k)';
    }else{
      this.formula = '(y-k)'+'2'.sup()+' = 4c(x-h)';
    }
  }

Thanks in advance.

You want the variable in the code itself to have superscript text? AFAIK that’s not possible. Now, if you mean to place text in a cell, then just format the characters. Does this thread help? What have you tried?