changeset 171:19e88fb18c4e javascript-exercises

Modify testtools.js to work with Rhino (and hope still works with jsdb).
author jf3243
date Thu, 10 Nov 2011 17:06:52 +0000
parents fc3411a0efe9
children e99460be1207
files core-javascript/javascript-exercises/testtools.js
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core-javascript/javascript-exercises/testtools.js	Thu Nov 10 16:52:51 2011 +0000
+++ b/core-javascript/javascript-exercises/testtools.js	Thu Nov 10 17:06:52 2011 +0000
@@ -3,14 +3,13 @@
 
 // Define a global function 'log'.
 var log;
-if (this.hasOwnProperty('jsArguments')){
+if (this.writeln){
+    log = writeln;
 
+} else {
     log = function(s){
         print(s + '\n');
     };
-} else {
-    log = print;
-    log = writeln;              // Wrong, but get us working in jsdb.exe.
 }
 
 //