Languages
[Edit]
EN

JavaScript - how to remove function from object?

2 points
Created by:
Marcin
18580

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);

 

Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join