EN
JavaScript - remove function from object
2 points
In JavaScript, it is possible to remove a function from an object in the following way.
xxxxxxxxxx
1
var student = {
2
name: 'John',
3
print: function() { /* nothing here... */ }
4
};
5
6
console.log(student.print);
7
8
delete student.print; //delete student['print'];
9
10
console.log(student.print);
Output:
xxxxxxxxxx
1
function() { /* nothing here... */ }
2
undefined