Ask coding questions

← Back to all posts
What am I doing wrong?
ia13ru (43)

I have this JavaScript code:

finalcode = "(9/9)"
var ind3 = finalcode.lastIndexOf(")");
var inde3 = finalcode.indexOf("(")
let value = finalcode.slice(inde3 + 1, ind3)
text.innerHTML = parseInt(value);
document.getElementById("output").innerHTML += text.outerHTML;

It makes the content equal to 9, not 9/9 which is 1. Why is it not working?(It is also Incompatible with*+-etc.)

Answered by Coder100 (17137) [earned 5 cycles]
View Answer
Coder100 (17137)

please, send a repl instead.

It is not clear what external variables like text and the HTML looks like.