I’m enjoying freeCodeCamp very much, especially the last month or so when I started javascript. When I have difficulty with a particular challenge, I’ve been opening up a blank tab in Chrome and using the developer tools to paste in my javascript and debug the code. it works ok, but I’m wondering what others use? I have a sense/hope that is a better alternative.
for example, I’m on Basic Data Structures: iterate through the items in an array link ).
Taking me a bit to work through and wanted to ask this question. thanks in advance for any suggestions!
I’d be interested in seeing the replies you get.
I do the same, Chrome and developer tools and repl.it but lately I’ve been finding it easier to use repl.it because I can type a lot faster, comment out one section or piece that’s working and then just put in another and see immediate results. Plus, with repl.it I can keep it and come back to it later.
If you write a variable or function and run the script twice you will see you get an error saying that variable is already declared because you are working in the global scope of the tab you are currently in.
You can just wrap everything in the snippet inside an IIFE (Immediately Invoked Function Expression) to avoid polluting the global scope and then you can run the script over and over.