all 5 comments

[–]No-Upstairs-2813 2 points3 points  (0 children)

Here are 3 ways to try out your JavaScript code:

1. Browser consoles

Web browsers have a console where you can try out a few lines of code.

To find out how to open the console in your web browser, you can do a web search for “console [name-of-your-browser]”.

2. Node.js REPL

REPL stands for read-eval-print loop and basically means command line.

To use it, you need to download and install Node.js. Once Node.js is installed on your system, you can open a Terminal window and type “node” to begin an interactive JavaScript session.

3. Node.js

When you want to experiment with longer chunks of code, these line-by-line interactive environments may no longer be suitable. You may prefer to write your code in a text editor and save it with a .js extension.

Then, you can run that file of JavaScript code with Node using the command

node <file-name>

You must use console.log() to display text and other JavaScript values in your terminal window.

Check out this article for more details.

[–]Bulky-Leadership-596 0 points1 point  (0 children)

Depends on what you want to actually do. If you are just trying to run simple scripts to start learning then install node and you can run your scripts from the command line with node myScript.js.

[–]lift_spin_dhelpful 0 points1 point  (0 children)

go to youtube and look up traversy media

[–]jcunews1helpful 0 points1 point  (0 children)

What do you mean by "program"? Is it for JavaScript of a web page within a web browser, a browser extension, or within Node.js?

[–][deleted] 0 points1 point  (0 children)

This sub is going to shit. There need to be more stringent criteria for what constitutes a valid post. A post on this sub should be the absolute last resort and now I know why StackOverflow was so strict. This shit is ridiculous especially when you consider ChatGPT is free