EN
JavaScript - how to remove function from object?
2
points
In JavaScript it is possible to remove function from object in 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);