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
Is it possible to use multiple scriptmanager controls on a web page? : asp.net ajax
Do ajax applications always deliver a better experience than traditional web applications?
What is the xmlhttprequest object?
What are the real web applications of ajax currently running in the market?
Explain the step property of the numericupdownextender control? : asp.net ajax
How do I handle the back and forward buttons?
What do I need to know to create my own ajax functionality?
Briefly describe asp.net ajax framework? : asp.net ajax
What are the components of the asp.net ajax architecture? : asp.net ajax
What are ajax extensions?
Define json?
What's the difference in HTML AJAX, ASP.Net AJAX?
Are there any security issues with ajax?
What is an ajax request and what is a simple example of where a ajax request would be used?
What is the syntax to create ajax objects? : asp.net ajax