.toExponential(3)).toLocaleUpperCase();
won't work because you are calling toLocaleUpperCase()
on the result of this statement:
document.createTextNode(array[index].toExponential(3));
which doesn't return a string, instead you need to call toLocaleUpperCase()
or toUpperCase()
on the result of the toExponential()
method itself, so that the resulting string is modified before it is inserted into HTML tree.
You can do it like this:
textelement = document.createTextNode(array[index].toExponential(3).toUpperCase());