I am trying to turn an object into a string in vanilla JavaScript for a library toString() function.
The desired output would be something like as follows.
var obj = {a: 1, b:2, c:"string"}
function toString(ins) {
    if(typeof ins === "object" && ins.length === undefined) {
        var str = "";
        //convert to string
        return str;
    }
}
toString(obj)
//should return "a:1, b:2, c:string"
I tried looking here,but couldn't find a suitable answer.
 
     
    