JavaScript – Handlers


What is a handler ?

Handler is a person who handles something.

What is a handler in programming language ?


A handler is defined as routine of tasks performed for the event.

An event is an action that occurs as a result of the other actions performed by the user.

Example for event is a mouse being clicked or a key being pressed.

Javascript beginner course !!!

Click to Learn More about – Javascript online learning

What is a handler in javascript ?

The events are actions which occurs when the user performs some action.

The handler is the one which handles the events triggered by user.

User can define these event handlers and that will execute the events.

Some users will automate this event handling task for performing actions automatically.

There are few methods in Javascript handlers listed below,

SnoMethod / FunctionDescription
1apply()apply() handler method is used to trap for a function call.
2construct()construct() handler method is used to intercept the new operation.
3defineProperty()defineProperty() handler method can define the new properties.
4deleteProperty()deleteProperty() handler method used to remove the property entirely using the delete operator.
5get()get() handler method is a trap for getting a property value.
6getOwnPropertyDescriptor()getOwnPropertyDescriptor() handler method is a trap for Object.getOwnPropertyDescriptor().
7getPrototypeOf()getPrototypeOf() handler method is a trap for the internal method.
8has()has() handler method used to “hide” any property you want.
9isExtensible()isExtensible() handler method a trap for Object.isExtensible().
10ownKeys()ownKeys() handler method of JavaScript is used to return an enumerable object.
11preventExtensions()preventExtensions() handler method is used to trap the Object.preventExtensions method.
12set()set() method is an assignment of a value to a property value.
13setPrototypeOf()setPrototypeOf() handler method returns a Boolean value true if [[Prototype]] was successfully changed.