Can we define an object with own property but use pre-defined method???
For Example:
I defined and Object: subject
And use it with a method i.e: subject.write

Can we???

Recommended Answers

All 2 Replies

Are you referring to the document.write predefined method? If so, just assign a reference to if for your own write property -ex.

var subject = new Object();
subject.write = document.write;
subject.write("hi");//works as if you had called document.write("...")

Thank You Very Much...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.