This is a code snippet relating to an object
Obj.prototype.save = function (fn){
var aabb = Obj.reEditName(this.name, function(newName) {
return newName;
// Additionally attempted
var foo = newName;
return foo;
});
console.log("aabb is : "+aabb);
}
Obj.reEditName = function(name, fn){
var name ? name : "TestingName";
nameEditor(name,function(err, finalName) {
return fn(finalName);
});
}
Obj.reEditName
is functioning properly and returns a value I can access through newName
.
However, console.log("aabb is : "+aabb);
is returning undefined.
I'm unsure why. I receive a value and return it, expecting aabb
to capture it. Why isn't this working? How can I pass newName
back to aabb
?
Thank you