Title / Description
Code <p>Click below to get started!</p> <button onclick="outputPosition()">☺</button> <p id="paragraph"></p> <script> function outputPosition() { var x; var letter=prompt("Enter any letter of the alphabet."); var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); var y = alphabet.indexOf(letter) + 1 if (letter!=null) { x="The position of " + letter + " is " + y; document.getElementById("paragraph").innerHTML=x; } } </script>
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code