Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of Error Thrown when Using 'in' Operator on Non-Objects #2427

Open
marccarigiet opened this issue Nov 7, 2023 · 1 comment
Open

Lack of Error Thrown when Using 'in' Operator on Non-Objects #2427

marccarigiet opened this issue Nov 7, 2023 · 1 comment

Comments

@marccarigiet
Copy link

marccarigiet commented Nov 7, 2023

  • Plattform: [Linux, Ubuntu 20.04]

Description
'in' applied to non-objects do not throw an error.

Test case
Test code to reproduce the behaviour:

'example' in true;
'example' in false;
'example' in undefined;
'example' in null;
'example' in this;
 
'example' in 'example';
'example' in 1;

Expected behaviour
Going by other JavaScript engines including V8, SpiderMonkey and JavaScriptCore I'd expect a TypeError to be thrown.

Additional context
This was found using comparative testing between multiple JavaScript engines. This could very much come down to a design choice. I just wanted to let you know in case it is not intentional

@marccarigiet marccarigiet changed the title Lack of Error Thrown when Using 'in' Operator on Non-Objects i Lack of Error Thrown when Using 'in' Operator on Non-Objects Nov 7, 2023
@gfwilliams
Copy link
Member

Thanks! I'll look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants