Calling "new" on a primitive value does not throw an error #801
Labels
bug
Something isn't working
E-Easy
Easy
execution
Issues or PRs related to code execution
good first issue
Good for newcomers
Hacktoberfest
Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
Describe the bug
Calling
new
on a primitive value (or, in other words, calling a primitive value as a constructor) does not error.To Reproduce
Expected behavior
![image](https://user-images.githubusercontent.com/31050943/95126567-b6ade980-0724-11eb-9b26-18a718200d35.png)
A
TypeError
is supposed to be raised. The spec can be found here (step 7). Chrome implements this properly:Build environment (please complete the following information):
Windows 10
Version 1909 (OS Build 18363.1082)
x86_64-pc-windows-msvc
rustc 1.46.0 (04488afe3 2020-08-24)
Additional context
MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new
Spec: https://tc39.es/ecma262/#sec-evaluatenew
The text was updated successfully, but these errors were encountered: