Does anyone mind referring me to a free text editor that is pretty easy to use? Thank You Kindly
Hey @davis.ihsaan,
This topic will answer your question and more:
Thank You Kindly. I have downloaded VS Code but cannot under stand how to run a code properly. Keep getting error messages. Sorry I’m a Nub
For windows there is always: notepad++
If your asking about more serious dev tools, VSCode is more or less the developer tool, especially for web development. (Not to be confused with Visual Studios)
Other mentions would be:
- sublime-text (will ask for you to buy a license but otherwise is free) - cross platform text editor with some plugins, older than the other choices but more lightweight
- atom - similar to VSCode, free, good amount of plugins
Thank You Kindly. I have installed notepad ++ however I can’t seem to figure out how to Run a simple code. Sorry I’m a nubie
A text editor doesn’t run code for you, it only edits text. Since the code/text can be any language, for any framework, for any system, it doesn’t make any assumptions.
Depending on what kind of code your writing, you can use either plugins, or other tools (like the command-line) to run/compile your code how you want.
Even a super tricked out VSCode installation usually leaves running code to external tools (like node), but it really depends on what kind of code your writing.
It’s just a simple Hello World code in Javascript. I would need to install Node in order to see the results of Hello World also?
Yes, JavaScript by itself is just text in a file. To “run it” you can run it in a browser (thats how websites work) or nodejs
can be used to run it as a different environment. You could also even use JavaScript in a game engine, (this was possible in Unity, idk if its still available, regardless its just an example)
Each environment can take the same basic code and “run it”, but might provide extra API’s, like a browser will provide your JS code the ability to do DOM manipulations. So node will give you the ability to call stuff in your system.
So if you want to run JS code, you can use nodejs, and thus you need to install nodejs.
Gotcha! Thank alot Bro!!
Thanks for explaining about this, I have heard about VSCode but didn’t quite get what it does/doesn’t do.
The key power of VSCode isn’t so much just the editor, rather its in its configuration and availability of extensions. There are a lot of extensions, of which can help you do any number of things. The other “text editors” I mentioned earlier (sublime and atom) also have plugins or extensions, but VSCode has the latest, most maintained and arguable the best extensions and support.
I believe one of the key reasons is due to the fact Microsoft is behind its development, and also contributes to a number of the high used extensions. This combined with it being opened sourced makes for an editor that is flexible, simple, and yet very powerful when setup correctly.
If you want an easy tool to write and run JavaScript, I recommend repl.it. There are other services that are better for integrated JS/HTML/CSS, but for simple JS I like repl.it
It depends on what you’re trying to run.
JavaScript can be executed in many different environments called “run times”. Broadly speaking the two main run times are NodeJS and a web browser.
If you’re trying to write NodeJS you run your code from the command line with node name_of_your_file.js
assuming you have NodeJS installed on your computer.
If you’re trying to execute JavaScript in the browser by loading an HTML file with a <script>
tag in it then you normally need to run an HTTP server.
There’s a package that helps you with this: https://www.npmjs.com/package/http-server
A simple way to get this to work would be to run npx http-server path/to/index.html 8080
in your VS Code terminal (assuming you’ve installed NodeJS which ships with NPM).
npx
is an NPM command that just temporarily installs the latest version of the package onto your machine and then discards it after the command has ran.
You’ll be able to visit http://localhost:8080 and see your web page running and any <script>
tags that are using src
attributes will work properly now
P.S.
This is partly why I’m not convinced JavaScript is always the best first language. There’s quite a few hurdles for complete beginners to climb over just to get a program to “run”.
And browser based coding environments like freeCodeCamp and CodeCademy hide all of this from you.
But you have to start somewhere and nothing about programming is going to be easy in the beginning. JavaScript is still king if you want to become a web developer even if it’s a bit confusing to get started.
Thanks a million bro!
Hey no problem!
If it helps I published an article years ago on this subject. It’s old, but all the concepts are still the same.