How to add a new property in existing function javascript?



How to add a new property in existing function javascript?..

Answer / Alka Singh

In JavaScript, you can add a new property to an existing function using the `function.prototype` or object literal notation: `myFunction.newProperty = 'value';` or `Object.defineProperty(myFunction, 'newProperty', { value: 'value' });`.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Interview Questions

What is an external javascript?

1 Answers  


Create a new javascript object with the keys of “fname” equal to your first name, “lname” equal to your last name, and “fcolors” equal to and array of 3 of your favorite colors. Assign this object to a variable called “me” and log it to the console.

1 Answers  


What is DOM? What is the use of document object?

1 Answers  


a code in vb script, which creates a table of 5*2 in html this is a static table, one more same dynamic table, as we give input the table should get created.

1 Answers   IBM,


What is the similarity between the 1st and 2nd statement?

1 Answers  


Explain what is pop()method in JavaScript?

1 Answers  


Please write the Code of simple javascript calculator withot eval() function

1 Answers  


Can an anonymous function be assigned to a variable?

1 Answers  


Give an example of closure?

1 Answers  


How to write html code dynamically using JavaScript?

1 Answers  


If an array with name as "names" contain three elements, then how will you print the third element of this array?

1 Answers  


What’s relationship between javascript and ecmascript?

1 Answers  


Categories