Several months ago, as the “year of learning to code” was getting underway, I wondered what it would be like to have a JavaScript REPL available for my mobile device.
I figured that I could build my own mobile app using the PhoneGap framework that would simply expose a large textarea that could be eval()‘ed at the tap of a button.
I bought an older Android tablet to prove the concept.
The program below is both a batch file and a JavaScript WSH console file. The dual nature of the file is achieved via JavaScript block comments and the strategy by which the command interpreter searches for target labels in a batch file.
Save the file below as hybrid.bat …
rem ( /*
@echo off
cscript /nologo /e:javascript hybrid.bat
goto end
*/ )
// by Jim Lawless
// This program sample is in the public domain
function rem() {
WScript.