Skip to content

Instantly share code, notes, and snippets.

@nexpr
Created May 26, 2017 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nexpr/eb2963ccdbcc3f33bfce49e2861f9b75 to your computer and use it in GitHub Desktop.
Save nexpr/eb2963ccdbcc3f33bfce49e2861f9b75 to your computer and use it in GitHub Desktop.
repl for JScript (windows10 only)
C:\Users\user\Desktop>cscript //E:{1b7cd997-e5ff-4932-a7a6-2a9e636da385} repl.js
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.
> if(true){\
> 1\
> }
1
> var a = 10
undefined
> a
10
> exit
let acc = ""
while(true){
WScript.StdOut.Write("> ")
const input = WScript.StdIn.ReadLine()
if(input === "exit"){
break
}
if(input.endsWith("\\")){
acc += input.slice(0, -1) + "\n"
continue
}
const source = acc + input
acc = ""
try{
const [result = "undefined" ] = [eval(source)]
WScript.Echo(result)
}catch(err){
WScript.Echo(err.message)
WScript.Echo(err.stack)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment