ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories >> Software >> Scripts >> Ajax
 
 


 

 
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 Ajax interview questions  Ajax Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
Question
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?
 Question Submitted By :: Seshumca34
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
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 ?    0 Yes 0 No
Sandesh Magdum
 
 
 
 
Other Ajax Interview Questions
 
  Question Asked @ Answers
 
what is the active x dll used for ajax. explain y we use ajax? Cognizent3
how long it will take to come the interview result of infosys? Infosys1
what is ajax  2
What is the Difference between AJAX and Javascript? T3-Softwares1
Is it possible to upload a file using Ajax ? Reason IBM2
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?  1
what is meant by AJAX and its purpose?  3
 
For more Ajax Interview Questions Click Here 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com