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 / rajesh

I maynot give the exact reason..but root cause may be
because of...

As you know the javascript is just parsed from top to
bottom. It won;t execute as long as you run the app.
While parsing it just holds the reference and checks for
syntactical errors.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is json? : asp.net ajax

547


What is the difference between synchronous and asynchronous requests?

505


Describe the animation extender control and the method by which this control is utilized?

572


What will happen with click of browser "back" button among asynchronous requests?

500


What's the difference in HTML AJAX, ASP.Net AJAX?

2029






What are the important methods of xmlhttprequest?

523


We used asynchronous server communication for a long time, what new thing is ajax bringing?

496


In what way are proxyless calls different than the proxied calls in ajax?

544


How to control how long an ajax request may last?

495


What are the new features of asp.net ajax 4.0? : asp.net ajax

534


Do we have to use http get/post for the ajax calls?

595


How can you debug asp.net ajax applications?

503


Can ajax be implemented in browsers that do not support the xmlhttprequest object?

510


How was ajax killed?

496


What are the types of open() method used for xmlhttprequest?

519