Skip to content

new String('foo') returns wrong type #284

Open
@rwaldron

Description

@rwaldron

While writing tests for #283 there were failures caused by new String("foo") return value being a string.

The correct return is a String object:

var o = new String('foo');
var s = 'foo';

console.log(typeof o === 'object');
console.log(o instanceof String);

console.log(typeof s === 'string');
console.log((s instanceof String) === false);

The expected result is true for all of the above, the actual results are:

false
true
true
false

Metadata

Metadata

Assignees

No one assigned

    Labels

    Standards IssueA place where Espruino doesn't conform to the ECMAscript standardlow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions