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

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("...")
Jump to Post

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 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.