EN
JavaScript - remove function from object
2
points
In JavaScript, it is possible to remove a function from an object in the following way.
1. delete
operator example
// ONLINE-RUNNER:browser;
var student = {
name: 'John',
print: function() { /* nothing here... */ }
};
console.log(student.print);
delete student.print; //delete student['print'];
console.log(student.print);
Output:
function() { /* nothing here... */ }
undefined