
If you are of a certain age, you probably learned to program in Basic. Even if you aren’t, a lot of microcontroller hobbyists got started on the Basic Stamp, and there are plenty of other places where to venerable language still hides out. But if you want to write cool browser applications, you have to write JavaScript, right? Google will now let you code your web pages in Basic. Known as WWWBasic, this is — of course — a Javascript hack that you can load remotely into a web page and then have your page use Basic for customization. You can even import the thing into Node.js and use Basic inside your JavaScript, although it is hard to think of why you’d want to.
According to the project’s documentation — which is pretty sparse so far, we’re afraid — the Basic program is compiled into JavaScript on page load. There are a few examples, so you can generally pick up what’s available to use. There are graphics, the ability to read a keyboard key, and a way to handle the mouse.
If you were thinking about old-school games, so was Google, apparently. It would be fun to pull out some of the old books full of Basic games and get Star Trek, Wumpus, and all the other games of that era in the browser. However, it looks as though some things that would be difficult are yet to be implemented (for example, the INPUT statement). We suppose you could write your own quasi-input function using INKEY but that would be painful.
We couldn’t find any way for the Basic code to interact with the browser data directly which is a shame because that means your output is limited to a virtual Basic “screen.” It looks pretty good for graphics, but the text output looks like an old-school computer, which is charming but not terribly practical. Microsoft’s VBScript technology for example, can write into the page just like JavaScript does, and that would be nice to see in WWWBasic.
Is it practical? Probably not, but we enjoyed seeing our old friend Basic show up in the browser again. The fact that unlike VBScript it is sort of retro just made it that much more fun.
If you want a more traditional Basic experience, Quickbasic is still around. Or, if you want to stay in the browser, you can do that, too. Incidentally, no actual donkeys were harmed during the production of this post.