Although pundits have joked that Java’s “write once, run everywhere” slogan might be better expressed as “write once, debug everywhere,” a relative of Java — JavaScript — has delivered on both promises better than its namesake. Thanks to its proliferation in browsers, JavaScript is a veritable lingua franca of computer languages which has led to entire applications being written in it using tools like Node.js and Electron, and not just browsers. But what if you are still using MSDOS or Windows 98? We know some of you do, at least on retro machines. Don’t feel left out, the DOjS project has jSH, a JavaScript engine for DOS and related operating systems.
Why? We don’t know, but we applaud the effort. The example from the project’s homepage shows how to rename all the file extensions in a directory:
if (args.length < 3) { Println("Usage:"); Println(" jSH.exe renall.js "); Exit(1); } var dir = args[0]; var oldExt = args[1].toUpperCase(); var newExt = args[2].toUpperCase(); var files = List(dir); for (var i = 0; i " + dir + "\\" + newName); Rename(dir + "\\" + oldName, dir + "\\" + newName); } } Println("All done...");
Of course, there are a million other ways to do this. On the other hand, there's a package manager -- assuming you have a working network connection, and we can imagine a few cases where this could be a little useful.
If you are trying to avoid JavaScript, you might have to consider retreating to CP/M. Or embrace it, and do your next logic simulation on MSDOS (maybe).
I’d prefer (for java) “write once, doesn’t run anywhere”. I’ve never seen something written in java that shouldn’t have been written in something else..
You and the author are both confused. JavaScript has zilch to do with java. If anything JavaScript is a dialect of lisp with C syntax.
So maybe you can get started on porting apache tomcat to some other language. It is the basis for many of the web apps that we all use every day. Which language will you choose?
Blu-ray? Menus 😉
I actually like java
Javascript on the other hand, object creation is just a pain in the butt, the language doesn’t like it, and it’s just hacks on hacks to make it work.
“…hacks on hacks to make it work.”
Ladies and gentlemen, JavaScript in 7 words.
Also TypeScript. It’s just even more hacks.
At home on a hacking site.
Everything in JS is an object though. But it’s really not difficult.
const foo = {}
Look up the Destroy All Software talk.
https://www.destroyallsoftware.com/talks/wat
Stop it. You’re scaring the non-JS developers. You know it’s easier to talk trash about JS than to actually learn it.
Isn’t Minecraft heavily riddled with Java?
One version of it (the original). There is another version that MS has done that isn’t Java.
JavaScript is not a relative of Java.
As once said, “Java is to JavaScript as car is to carpet”
Or “Java is for JavaScript what Ham is for Hamster”
In that you can make them both work for various usecases.
But a hamster sandwich is incredibly frowned upon.
Java is as much a relative of JavaScript as C is to COBOL. It contains the same letter is all. Ok there might be a bit more to it but not much and certainly not enough to call them related.
Javascript on MS-DOS isn’t that strange. There were still MS-DOS based OSs (eg win95) that came out after it’s invention. It’s old enough that the JWST runs on it.
There is something very funky up with those brace brackets and that for loop.
Yep, and besides the missing opening brace, the variable newName is never defined or set up. I assume they meant to use newExt and oldExt?
The code didn’t survive being pasted into whatever Hackaday uses for an editor. It looks a lot less WTFy on github.
I have always considered JavaScript to be the perfect example of how NOT to design a programming language.
JS sucks because it was “designed” in 10 days as an alternative to embedding Scheme into Netscape Navigator. And the name was a total marketing trick. It had to be new and have a cute name. Quality or consitency were not in the plan.
PayPal moved from java to node. Java is designed wrong from ground up.
https://youtu.be/Aa55RKWZxxI
https://youtu.be/wfMtDGfHWpA
I am happy that I am not grown up in Java land
If you grown up in Javascript land you might think different
What I miss is Controle de Scripts, a browser plugin that could finely control what types of Javascript actions would be allowed or blocked. For example it could allow user initiated popups but block any that were automatically done by the code. So goodbye to those annoying auto-forwards while still opening things like login popups.
It could also block any blocking of right clicks, highlighting, copying, and pasting.
After moving on from my Tandy Color 3 TRS 128k to a Packard Bell 486SX 33MHz 1MB RAM 210MB HDD 2400baud modem in the early 1990s I became almost in love with MS-DOS. Anyhow.
I wouldn’t mind breaking out a virtual machine with MS-DOS and a 32 bit capable Pascal or C compiler and creating a web browser that can work with that DOjS / jsh project.
Sounds like fun but I would turn completely gray before I got close to 1/2 way done with it.
Worth mentioning what the requirements are: 386 with 4 MB. That’s a early-1990s machine, not early 1980s. Neither IBM PC nor AT can run this. And they really recommend a Pentium with 8MB. That’s the same requirements as early Linux. So yes it’s MS-DOS, but still requires a hefty machine for the time.
It’s too bad that even cut-down versions of modern languages require hefty resources. Java Virtual Machine code can be emulated on a 6502 Apple IIe (if 128K), or even translated to 8-bit processors with the “Grinder”, but none can self-host a Java compiler. I’ve looked into compiling MicroPython into a 8-bit, but it requires 32-bit ints and is just too big. MicroPython might fit into a full-memory IBM PC if somebody can get the right C compiler to compile it.
> It’s too bad that even cut-down versions of modern languages require hefty resources.
Let’s dedust PCC! C, C++ and Fortran for multiple targets in the size of fly shit compared to GCC and LLVM.
And no central internet repo for sources. Remember the hacked pip repo and the daily JS problems? That alone makes me want to not touch these open doors for infections. GO? No way!
Ever tried to bootstrap ZIG on a 32bitter?
Does it work again?
Will it be even bigger than Symbiflow when it reaches 1.0?
We’re heading the wrong way with IT.
And we’re doing it full throttle.
Does someone still count errors?
Or do we just live with them because the next blingbling is more important than bug free code?
And yes, I still love CP/M, the Z80 and the M68k!
But a Unix is a sweet siren too…
Java is to to JavaScript, as Hula is to hula-hoops. This is how I usually explain it to students.
Either there is some sever built-in file.renaming magick in JavaScript, or that code is missing something. Such as how to convert from old/newExt to old/newName.
Or a it’s a bit weird .the usage example contains one argument, but the program requires 3 to do any action.
When applying for a programmer job it is vital to ask ‘How much server side Javascript do you use’?
If the answer is anything but ‘none’, _run_ away. You don’t want to work for a company that makes that kind of decision. Everything else will be equally stupid.
There’s a saying “Java is to JavaScript as fun is to funeral”.
I’ve had funerals that are … well, fun is maybe not the right word, but more enjoyable than some weddings I’ve had (both as guest)
Oh Norton Commander !
Fabrice Bellard, legend for other things such as ffmpeg and qemu, has written QuickJS, https://bellard.org/quickjs/, which should run modern js, in perfectly conformant C89, and might also be targetable to DOS with an old enough compiler to target DOS.
Come on, Java is actually cool. Install the JVM on any device and you can run 20 year old Java programs on your brand new computers.
Javascript is a monstrosity that has been consistently slowing down web browsers for the last decade, with no sign of slowing down. It is a key component of contemporary planned obsolescence of computers, smartphones and tablets, as it renders web browsing almost unusable after a year or two with no added value from the user, since most of what JS does is data harvesting for FB, Google and the lot.
JavaScript’s versatility extends beyond the web, proving its adaptability even in environments like MS-DOS. This underscores its powerful capabilities and widespread utility across various platforms, making it a truly ubiquitous programming language.