How can we assign an object in Java Script??
For Example:-
-----------
If i create an object "obj1"
var obj1 = Object();
obj1.name = "hari";
and if i want to assign it to two objects "obj2" and "obj3"
with different names...
obj1.name = "gopi"
obj2 = new Object(obj1);
obj1.name = "raghu"
obj3 = new Object(obj1)
Now ob2.name become to "raghu" from "gopi". WHY?
how to solve the above problem?
Answer Posted / sandesh magdum
var obj1 = Object();
obj1.name = "hari";
obj1.name = "gopi";
obj2 = new Object(obj1);
//preserving name property of obj2 through obj4
var obj4=new Object();
obj4.name=obj2.name;
obj1.name = "raghu";
obj3 = new Object(obj1);
obj2=new Object(obj4);
alert("obj2 name="+obj2.name+" obj3 name="+obj3.name)
| Is This Answer Correct ? | 5 Yes | 3 No |
Post New Answer View All Answers
Describe the animation extender control and the method by which this control is utilized?
What is synchronous request in ajax?
Easy trough that the classical web applications are harder to make than ajax applications?
Is the asp.net ajax control toolkit(ajaxcontroltoolkit.dll) installed in the global assembly cache?
What do I do on the server to interact with an ajax client?
What is the role of scriptmanager in ajax?
Will html_ajax integrate with other javascript ajax libraries such as scriptaculous? How would this integration look like?
What are the tools for debugging ajax applications?
How does html_ajax compare with the xajax project at sourceforge?
What kinds of applications is ajax best suited for?
What is ajax used for?
What is the name of the dll that contains the ajax control toolkit?
What are asp.net ajax 4.0 validation controls?
What are the types of send() method used for xmlhttprequest?
How do I access data from other domains to create a mashup with java?