or should they be in an HTML code ?
There’re a few sites out there, I like to use Code Sandbox.
You could also load up your developer tools on any web page and run things in the console.
If the functions you want to test don’t need to be run in a browser then you can use nodejs to run your JS at the command line.
where is the console of a web page?
how to load my developer tools on a webpage and what are developer tools?
While using your browser press the F12 key to pop open the dev tools. You should see a Console tab at the top that will allow you to execute JS. It’s great for doing short little snippets of JS but if you have functions you want to test with input then I would recommend nodejs instead.
You should definitely get familiar with the dev tools as they are the developer’s best friend.
For Chrome: Open a new tab, right click anywhere and click on “Inspect” in the menu. Then you will get something like this in a portion of the webpage.
Elements tab -displays HTML for that webpage.
For now, we need the Console tab… click on it… ignore whatever errors already there (they would we because of the new tab)… just copy-paste your code in the console and press enter.
In case you are using Safari, go to → Preferences → Advanced → CLick on “Show Develop menu in Menu bar” .
i dont know how to use nodejs
There are a ton of tutorials out there. I’m sure you can find one that works for you.
anything with a console will show you that if you use
console.log to print the function result, including while you are working on fcc challenges
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.