var s = {
fname:'Ashish',
lname:'Gokhale',
getFullName: function(){
return this.fname +' '+ this.lname;
}
}
var p = {fname: "Xyz", lname: "Abc"};
Above are my two javascript object.
I want full name with p's variable without copying the data from any object.
I want this in a way that both object will retain there original value what they currently have. Is there any way to achieve this?
p; then what's the relevance ofs?getFullName(){should begetFullName: function(){var s = { fname:'Ashish', lname:'Gokhale', getFullName:function(){ return this.fname +' '+ this.lname; } } var p = {fname: "Xyz", lname: "Abc"}; s.fname=p.fname; s.lname=p.lname; console.log(s.getFullName());