Look at the call Stack and Watch, Now when i press F10, the line's value in "Watch" changes to be "object Object" and because of that everything happens, i understand the flow till this time and afterwards what happen is not clear. Now on wards, why does the code doesn't stop at line 8 even if I Provide a break point at line 8
This is the question on stackoverflow
I am trying to understand this code snippet
function assign(obj, prop, value) {
if (typeof prop === "string")
prop = prop.split(".");
if (prop.length > 1) {
var e = prop.shift();
assign(obj[e] =
Object.prototype.toString.call(obj[e]) === "[object Object]"
? obj[e]
: {},
prop,
value);
} else
obj[prop[0]] = value;
}
var obj = {},
propName = "foo.bar.foobar";
assign(obj, propName, "Value");
How recursion is happening, as the function is not returning anything ? How the value of the arguments in the inner call being changed as the function in the top most call stack(of assign function) is completed ?
Thanks all for answers but my exact question i how its happening in this particular line (line 8).