Created
January 18, 2012 03:05
-
-
Save jasondentler/1630601 to your computer and use it in GitHub Desktop.
Wat!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function print(value) { | |
if (typeof(value) == 'string') | |
return WScript.stdout.write(value); | |
if (typeof(value) == 'number') { | |
if (isNaN(value)) | |
return WScript.stdout.write('NaN'); | |
return WScript.stdout.write(value); | |
} | |
if (value == null) | |
return print("null"); | |
if (value instanceof Array) { | |
return String(value); | |
} | |
WScript.Echo(value); | |
}; | |
function output(value) { | |
if (value instanceof Array) { | |
WScript.Echo('Array with ' + value.length + ' elements'); | |
print(value); | |
} | |
WScript.Echo(typeof(value)); | |
print(value); | |
WScript.Echo(''); | |
} | |
var line = null; | |
while (line != '') { | |
WScript.stdout.write(">"); | |
line = WScript.stdin.readline(); | |
if (line != '') { | |
try { | |
var x = eval(line); | |
output(x); | |
} catch (e) { | |
WScript.Echo('Error: ' + e.message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment