Skip to content

Instantly share code, notes, and snippets.

@slavkapiyavka
Created June 20, 2023 21:42
Show Gist options
  • Save slavkapiyavka/2704c3db836a95aa39834121ad119e96 to your computer and use it in GitHub Desktop.
Save slavkapiyavka/2704c3db836a95aa39834121ad119e96 to your computer and use it in GitHub Desktop.
check creation of an object using keyword 'new'
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