Project Feedback: Wikipedia

Link is here!

Once past the cors and the random generator issues, this wasn’t too bad. Again feedback is welcome!

Matt

Nice work. Some suggestions:

  1. clean up the code, fix indentation, empty lines etc. so it’s more readable
  2. you’re already using jQuery, so instead of stuff like document.getElementById("results"); you could have written $('#results')...
  3. Sometimes you use unnescessary variables like in here:
function keyPress(e){
    var x = e
    var key = (x.keyCode);

instead of simply: var key = e.keyCode
or

$("#randomButton").on("click", function(){
      var ul = document.getElementById("results");
      ul.innerHTML = "";

which could be just:

$("#randomButton").on("click", function(){
      $('#results').innerHTML = "";

Maybe refactoring code is not as fun as writing it, but you have a room for improvements here :slight_smile:

Thanks so much! Sometimes I get in such a huff to complete that I get lazy with the details, definitely something to fix. Also js is still new and sometimes things that should work don’t, and so I start tearing up my code trying to understand the break. But this insightful critique will definitely help me grow.