I have a project that requires me to convert an Object to a string, without using stringify. The aim of this is to implement a recursive function that converts an object to a string. I seem to be having 2 problems here:
1) My function to output the Object as a string, only seems to be outputting the first value, not the rest.
function myToString(argObj) {
    var str = "";
    for (var val in argObj) {
        if (argObj.hasOwnProperty(val)) {
            str += val + " : " + argObj[val] + "\n";
            console.log(str);
        }
        return str;
    }
}
2) My understanding of the above for in loop, would be that it would print each key/value pair in the object, but it is only doing so for the first key/value. Using recursion, how can I get this to run over each key/value pair.
 
     
    