- Prototype Tutorial
- Prototype - Home
- Prototype - Short Overview
- Prototype - Useful Features
- Prototype - Utility Methods
- Prototype - Element Object
- Prototype - Number Processing
- Prototype - Strings Processing
- Prototype - Array Processing
- Prototype - Hash processing
- Prototype - Basic Object
- Prototype - Templating
- Prototype - Enumerating
- Prototype - Event Handling
- Prototype - Form Management
- Prototype - JSON Support
- Prototype - AJAX Support
- Prototype - Expressing Ranges
- Prototype - Periodical Execution
- Prototype Useful Resources
- Prototype - Quick Guide
- Prototype - Useful Resources
- Prototype - Discussion
Prototype - $H() Method
The $H() function converts objects into enumerable Hash objects that resemble associative arrays.
The $H function is the shorter way to obtain a hash.
Syntax
$H([obj])
Return Value
A hash object.
Example
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function ShowHash() { // let's create the object var a = {first: 10, second: 20, third: 30}; // now transform it into a hash var h = $H(a); alert( h.toQueryString()); } </script> </head> <body> <p>Click "Show Value" button to see the result</p> <form> <input type = "button" value = "Show Value" onclick = "ShowHash();"/> </form> </body> </html>
Output
prototype_utility_methods.htm
Advertisements