r/learnjavascript • • 1d 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

10 Upvotes

24 comments sorted by

8

u/Dazzling_Music_2411 1d 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 1d 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.

6

u/IAmTheRedditBot 1d ago

Electron could be smth for you

2

u/Mbwiria_Godlee 13h ago

Seconding this, its pretty heavy on memory usage sometimes though

5

u/Icy-Taste-3096 1d ago

Electron was made for exactly this purpose

1

u/LucVolders 22h ago

too much overhead.
Can be done easily without a framework

1

u/xxcrucialxx 1d 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 1d 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/traplords8n 1d 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.

4

u/fckueve_ 1d ago

you can create desktop apps with JavaScript, easily using electron. For example, Spotify, slack, discord, are all JavaScript apps (the desktop ones too). Shit ton of new desktop apps are done in JS.

3

u/realmauer01 1d 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.

2

u/Discordbothost 22h 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.

2

u/LucVolders 22h 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/TheRNGuy 20h ago

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

1

u/wbport1 1d 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/MauriceM7 1d 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

5

u/fckueve_ 1d ago

How is not suited? There are shot ton of desktop apps in JS. Spotify, slack, Discord, and many more. I'm mean yeah, performance is not great, and you can definitely do desktop apps on JS.

0

u/SoMuchMango 1d ago edited 22h 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.

4

u/fckueve_ 1d ago

Limited how? You can do filesystems, and emulators in JS. Please name one thing, you cannot do in JS?

1

u/SoMuchMango 1d 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/fckueve_ 1d ago

https://www.youtube.com/watch?v=fTBwD3sb5mw&t=7s

Here is a tutorial, on how do do virtual machine in javascript, emulate a specific processor architecture, and compile c-like language, all in javascript.

What is not part of javascript? The question is: "s there a way to make desktop applications using javascript".

Yes, you can do react in electron for example. I know Electron is not a part of javascript, but javascript is a part of electron, so you can easly do a desktop app using javascript, via electron.

Multithreading is a bit more complicated. You techncly have webWorkers, but those kind of sucks. But javascript is not single-threaded. It's single thead **execution**, but V8 for example uses multiplethreads to manage event-loop.

2

u/SoMuchMango 1d ago edited 1d 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 22h 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.