t2a19-leet-david.html



  • Ask chatGPT for a beginner friendly javascript leet code question.

  • Record the question on this webpage

  • Write your code to solve the problem within Pre tags

  • Ask chatGPT to make an html javascript single file answer without any css.


    1. Ask chatGPT for a beginner friendly javascript leet code question.

    2. Write a function that takes a string and returns it reversed.

    3. Within PRE tags show your version of the leet answer without looking at the actual answer.


    4. My attempt at writing code without chatgpt:
      
        <script>
        function myReverse(){
          document.getElementById('MyStringIn').innerHTML=document.getElementById('MyStringOut').value
      let myIn = document.getElementById('MyStringIn')
      let myOut= document.getElementById('MyStringOut')
          myOut.innerHTML = innerHTML.(reverseString('myIn')
        }
        </script>
        <input type="text" value="Input" id="MyStringIn">...</div>
          <div id="MyStringOut">Output</div>
        <input value="Reverse value of ..." type="button" onclick="{myReverse()}>
      


    5. Chatgpt working code:
      Output