Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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) );
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #javascript
ADD COMMENT
Topic
Name
9+7 =