function test1() { delete Object.prototype } var test2 = new Function(` delete Object.prototype `) var test3 = new Function(` 'use strict' delete Object.prototype `) var test4 = new Function(` 'use strict' return function() { delete Object.prototype } `) try { test1() } catch (err) { console.log('test1', err.message) } try { test2() } catch (err) { console.log('test2', err.message) } try { test3() } catch (err) { console.log('test3', err.message) } try { test4()() } catch (err) { console.log('test4', err.message) }