Skip to content

A strange testcase about RegExp Object of rhino. #665

@ty5491003

Description

@ty5491003

Testcase & Output

testcase1:

var a = new RegExp("1");
print(a(1));

output1:

null

testcase2:

var a = new RegExp("1");
print(a(2));

output2:

1

Other JS Engines Output

TypeError: a is not a function.

Rhino Version

1.7.11

Description

In my opinion, a is an Object, not a function. I don't know why rhino can execute these two testcases without throwing an exception and get two different result? Maybe it's a bug? or a feature?

So I need your help. Looking forward to your reply, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions