Setting up an environment to work with JavaScript

I’ve been doing the Basic JavaScript course and things are going well so far. But in trying to do the Record Collection project I really wanted to be able to test my code by sending different variables into the function.

However, within the course, all I can do is change things in the code and run the tests. I’m sure this is fine for some people, but I’d like to actually debug on my own.

Can anyone recomend articles that explain how to set up a way to run JavaScript on my device so I can see the results of the code?

Ideally I’d like to use VS Code. All the guides that I have tried to read are going right over my head. I just want something simple where I can play with the things I am doing in the course.

Sorry if my question doesn’t make sense. Please let me know if I need to give more info.

the fcc environment has console frame and if you put console.log("something") you can see its output, thus, you can output for example a particular function with your own parameters and see what it returns. Isnt that what you want to achieve?
Ive grew so used to code in the FCC environment that i often find myself going to a random FCC challenge and test simple code there, whenever i create some function for a project, or whatever

1 Like

Ooooh. This is the answer I think I needed, but it is not really the answer that I wanted. Thank you so much. This is going to be a huge help.

I’ll keep it marked as unsolved for now in case anyone else wants to offer other suggestions.

Once you move to the microservices lessons, you will be shown htps://replit.com/, a quick way to set up a pure javascript “sandbox” (node), an html-css-js one, or any of a multitude of other languages for later learning. But there is no reason not to start playing with repls now! If I’m stuck on a lesson, or want to explore something more, I’ll often just set up a repl.

Also, though, you might want to start learning about the developer tools built into your browser. You already have access to a very powerful debugger. Just Google “debugging javascript with dev tools”.

1 Like

console.log(yourVariable) and your browser’s developer tools are your friends, as @Sylvant and @snowmonkey pointed out.
Other than that, I second your idea of using VS code. It’s quite beginner-friendly in my opinion, and you can install the free version of the Quokka extension to visualize variables’ value in real time.
You can solve the challenges in VS code and then copy/paste your solutions in the freeCodeCamp code window.
Hope that helps.

1 Like

That looks really interesting! I’m afraid that there is a super steep learing curve for VS Code, though. I’ve installed that extension and when I try to run it on a file, some error messages popped up but then disappeared too quickly for me to read. There must be a log of those errors somewhere. I’m afraid this isn’t the best place to get help on this, though. Seems like there was something about node not being installed? Do I have to have some sort of Node.js installed or running?

As @snowmonkey suggested, repl.it is a great tool that I have personally used a lot.

It has also the added benefit that being an online repl you can share your code to anybody pretty easily.

However lately I was suggested runjs by a coworker, and I have been using that since, mainly to avoid the friction of opening a browser, and rather start typing right away.

1 Like

I’m afraid without the error messages there is not so much I can do to help you, but I’m sure that with time you will figure it out.
I didn’t know RunJS though (thanks @Marmiz ) and it may be a more simple and immediate alternative…you may want to check it out.

1 Like

It been a bit since i installed quokka, but yes i believe you need node.js installed for it to work. There was a nice video on some nice tips for using VS code that shows how useful it can really be once you get deeper into it.

1 Like

Thanks! Just finished it and it is indeed very helpful. His channel looks good too.

Thanks! Just to follow up, in order for Quokka to work, you have to have node.js installed on the machine (not as an extension to VS Code). It is really not clear that this is a requirement, but I eventually figured it out. It is probably obvious to a non-beginner. If you need to install it, here is the link: Download | Node.js

1 Like

Well, I’m a beginner too :grinning: , in fact I hadn’t thought about Node.js missing in your system in replying to you.
I just had it already installed before installing Quokka.
Happy coding!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.