I'm in the process of creating a basic JavaScript calculator that prompts the user to input their name and then displays a number based on the input. Each letter in the string will correspond to a value, such as a=1 and b=2. For example, if the user enters "acb" into the input, it should display abc=1+2+3 =6. Thanks!
<input type="text" id="myText" value="">
<button onclick="myFunction()">Try it</button>
<p id="calc"></p>
<script>
function myFunction() {
var x = document.getElementById("myText").value;
document.getElementById("calc").innerHTML = x;
}
</script>