Created
June 20, 2023 21:42
-
-
Save slavkapiyavka/2704c3db836a95aa39834121ad119e96 to your computer and use it in GitHub Desktop.
check creation of an object using keyword 'new'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Fruit() { | |
if(!(this instanceof Fruit)) { | |
throw Error('Error: Incorrect invocation!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment