r/learnjavascript • • 5d ago

Advanced javascript?

So i am a student whom enjoys making various small projects in free time with few languages but i have been wondering, as i have used javascript to make few static websites, and programs since it was very interesting to try and as javascript has a lot of built in functions and elements that allow various ways to solve problems, is there a way to make desktop applications using javascript and how precisely? Please explain, even a hint would be useful

11 Upvotes

26 comments sorted by

7

u/IAmTheRedditBot 5d ago

Electron could be smth for you

3

u/Mbwiria_Godlee 4d ago

Seconding this, its pretty heavy on memory usage sometimes though

5

u/Icy-Taste-3096 5d ago

Electron was made for exactly this purpose

0

u/LucVolders 4d ago

too much overhead.
Can be done easily without a framework

9

u/Dazzling_Music_2411 5d ago

The whole point of using JavaScript is to take advantage of its wonderful graphics capabilities IN THE BROWSER. IOW, JS "desktop" applications are just web pages. You have probably seen loads of them, even if you didn't realize it at the time. Spreadsheets, language IDEs, games, graphics programs like Desmos. etc. etc...

The Web pages don't have to run on the WWW. They can be served locally from your own computer if you wish.

Using Javascript only as a backend, as others have said, won't allow you to make impressive displays, although, of course, you can still use it for normal computing - it just won't look like much.

5

u/otheyhigh 5d ago

I agree. Continue building applications for the browser. The browser engines have a lot of capabilities exposed as APIs. Quite a few local system relevant APIs as well. Like USB, Files etc. (most are limited but would be fine for local apps)

If you end up with a use case that needs capabilities just not possible through the browser APIs, then start exploring things like electron.

4

u/realmauer01 5d ago

Electron is pretty much what you want. Its practically bundleing your code with a browser and then that browser showing just that one website that your code produces.

4

u/Discordbothost 4d ago

Try the Electron first-app tutorial with one of your static sites. In the example, point loadFile at your own index.html, then run npm start and see if an existing button still works. You can do that first pass with the HTML, CSS and JS you already wrote.

1

u/xxcrucialxx 5d ago

What other kinds of projects with what languages have u done, if I may ask? Sorry, u made me a little curious....lol

1

u/ConnectAffect2346 4d ago

Well i made few static web sites, few web apps using flask for backend, few python programs, few c++ programs, (i already mentioned about what i did with javascript so no need to mention again), few simple sql databases, few dataset analysis projects using python and r and few shell scripts, nothing much😅

3

u/LucVolders 4d ago

You can turn a Javascript program with some HTML and CSS into a "stand alone" program that works offline.
It does use the browsers enigine but it runs in its own window.
This is called a PWA (progressive Web App). There is actually a lot of fuzz around this but in fact it is very easy.
Web apps can have their own icons (just like any program) and when written well they can be run on Android, Iphone, Windows, Linus and IOS computers. Write once: run everywhere.

If you want to read more about this you can check my website:
https://lucstechblog.blogspot.com/2026/11/web-apps-explained.html

2

u/CuAnnan 2d ago

Wrapping my head around functions returning functions let me do great things with my Controllers

2

u/traplords8n 5d ago

It's really not the tool for the job. I think you CAN create some sort of desktop program with node, but it's built to be a backend and i'm sure it's way more complicated than using a language like python instead of javascript.

1

u/wbport1 5d ago

You can avoid the browser by putting .hta instead of .html at the end of a file you keep on your desktop. It will have a simpler display and may not have debug features.

1

u/TheRNGuy 4d ago

I'd recommend React with TS instead of vanilla JS. 

0

u/MauriceM7 5d ago

Don't use Javascript. Do the horses for courses. Javascript is for the browser. So essentially you would have to have browser embedded in a desktop framework. You could do the node thing if you dont want ui. But I would say if you want to write desktop apps then use the appropriate language as Javascript is not suited for it

1

u/CuAnnan 2d ago

Electron and its ilk allow full features applications in JavaScript. Why would you not?

-1

u/SoMuchMango 5d ago edited 4d ago

Wait what? JavaScript has relatively small amount of builti-in functions. Web platform is quite nice, browser has a lot of APIs to do certain stuff, but language features are kinda limited. It's much better right now, but f.e. Python is a much richer language.

3

u/[deleted] 5d ago

[removed] — view removed comment

1

u/SoMuchMango 4d ago

It's not part of JavaScript. It's part of browser or node API.

Standard library and language features are most lacking part of JavaScript.

No type checking, no tuples, no multithreading.

What do you mean by emulators?

2

u/[deleted] 4d ago

[removed] — view removed comment

3

u/SoMuchMango 4d ago edited 4d ago

Electron is an correct answer for the question. This is the way to do desktop apps in JS.

I'm saying that JavaScript as a language is lacking of many quality of life features. There are languages with better set of features. Web platform gives a tons of great APIs, but language itself is very poor, not limiting what you can do with it... More like lacking many features like type checking, pattern matching, range looping. You can live without that, but it is worth to check what other languages have.

People are writing emulators in JS as a learning exercise. Everything can be written in any programming language if you don't target highest quality.

1

u/Jasedesu 4d ago

Better 'quality of life' is always 'more expensive'. You still need to be able to work with basic tools and no comfort blankets if you want to say you know JavaScript. Learning without the nice to have things will ultimately give you a better understanding of the language and an appreciation of what the nice to have things do for you. We should not deprive beginners of an important part of the learning process.