0

I use some kind of a library that declare

slide.prototype.removeClick= function(){
//something here
}

How to remove the prototype of removeClick in my js file? I can comment out or delete that chunk in the library js but that's not a good practice.

3
  • @torazaburo seriously? can't I just set it to null or something? I don't want to modify the plugin.js because I have to reuse it on somehwer else. Commented Jun 29, 2015 at 4:51
  • Why would you remove it? Can't you just ignore it? Commented Jun 29, 2015 at 4:52
  • @torazaburo says I have 2 module using that plugin, I will have plugin.js and plugin2.js. What's if I have 10 module need to use that plugin, I will have to have 10 different version of that js. Commented Jun 29, 2015 at 4:56

3 Answers 3

1

Since presumably some code is going to call that function and you probably don't want a script error to occur at that point, you can just replace the existing function with your own dummy function by just reassigning the removeClick method to a new dummy function:

slide.prototype.removeClick = function(){}
Sign up to request clarification or add additional context in comments.

Comments

0

Try delete slide.prototype.removeClick or slide.prototype.removeClick = null

Simplest way without intrusion

Comments

0

here function created using 'Prototype' is a kind of 'Object' and we have facility of deleting object so as @jfriend00 said you can delete it using 'delete'.

and i would suggest if you are not gonna use that prototype function then just delete that particular lines of code man..!!! that will reduce your Complexity.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.