iotjs icon indicating copy to clipboard operation
iotjs copied to clipboard

console.log fails for anything other than a non-empty string

Open roryrjb opened this issue 11 years ago • 3 comments

Aside from https://github.com/Samsung/iotjs/issues/133, console.log fails for anything other than a string; see script below, I've included the expected output as displayed by Node v0.10.40, Node v0.12.7 and io.js v2.4.0, and the latest build of IoT.js from the master branch.

// statement                    node/iojs         iotjs

console.log('hello world')      // hello world    hello world
console.log(1)                  // 1              uncaughtException: undefined
console.log(9 + 10)             // 19             uncaughtException: undefined
console.log(null)               // null           uncaughtException: undefined
console.log(true)               // true           uncaughtException: undefined
console.log(false)              // false          uncaughtException: undefined
console.log(undefined)          // undefined      uncaughtException: undefined
console.log(0.09)               // 0.09           uncaughtException: undefined
console.log(NaN)                // NaN            uncaughtException: undefined
console.log(function () {})     // [Function]     uncaughtException: undefined
console.log({})                 // {}             uncaughtException: undefined
console.log([])                 // []             uncaughtException: undefined

roryrjb avatar Jul 26 '15 12:07 roryrjb

@roryrjb Thanks for reporting it. At this time console.log() only prints string and fails for any other arguments. We are preparing equivalent functionality with node.js. but we have to wait implementation of String.prototype.replace() of JerryScripts. After that it'll print all this request.

ILyoan avatar Jul 27 '15 01:07 ILyoan

@ILyoan thanks for your response. Keep up the good work :+1:

roryrjb avatar Jul 27 '15 06:07 roryrjb

Close as #156 landed. Printing result is different from node.js since it requires not a few implementation. Feel free to reopen if needed.

ILyoan avatar Aug 03 '15 01:08 ILyoan