Skip to content
Advertisement

I have this python code that I am trying to turn into javascript but I cant seem to figure out which if statement. to use

This is the python code im trying to convert into javascript.

JavaScript

I want to be able to write anything and get each letter written to the page. This current code writes ‘a’ even if you put the wrong letter.

How can I input something and have it write to the page?

JavaScript

Advertisement

Answer

Many issues. = is assignment and == or === is comparison just like in Python.

Also not you should NEVER use document.write after the page has loaded. It will wipe the page.

Here is a working version taking all letters you type (as long as they are A, B, or C)

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement