Contact: aviboots(AT)netvision.net.il
41,219 questions
53,721 answers
573 users
function f() { if (!new.target) { throw 'f() called without new'; } console.log('f() called without new') } try { f(); } catch (e) { console.log(e); } /* run: f() called without new */
function f() { if (!new.target) { throw 'f() called without new'; } console.log('f() called with new') } let o = new f(); /* run: f() called with new */