toObject () javaScript

// Prototype - toObject() method returns a cloned, vanilla object.
// Syntax
hash.toObject();

// Example
var h = new Hash({ a: 'apple', b: 'banana', c: 'coconut' });
var obj = h.toObject();

// Output: "Object.inspect(h) : #<Hash:{'a': 'apple', 'b': 'banana', 'c': 'coconut'}>"
console.log( "Object.inspect(h) : " + Object.inspect(h) );

// Output: "Object.inspect(obj) : [object Object]"
console.log( "Object.inspect(obj) : " + Object.inspect(obj) );

// Output: "h.get('a') : apple"
console.log( "h.get('a') : " + h.get('a') );

// Output: "Object.keys(obj) : a,b,c"
console.log( "Object.keys(obj) : " + Object.keys(obj) );
Tomanator