Below is a Basic example of Function name Property.
Property Values: This property has three attributes as mentioned below:
- Writable: No
- readable: No
- configurable: Yes
Returns: This property returns the string i.e the name of the function.
Code for the above property is provided below:
Program 1: When the simple function is given
Name of the function func2 is: func1 Name of the function func2 is: func2 Type of func.name is: string
Program 2: When an object of function is given.
Name of the function function1 is: functionName1 Name of the function function3 is: function3
Program 3: Using the name property on an instance of the function.
obj[object Object]is an instance of function func
Program 4: Using the name property on the bounded function.
Name of the bounded func is: bound func
- Google Chrome
- Internet Explorer
- Microsoft Edge