Copyright © tutorialspoint.com
The $H() function converts objects into enumerable Hash objects that resemble associative arrays.
The $H function is the shorter way to obtain a hash.
$H([obj]) |
<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>
|
This will display following result:
first=10&second=20&third=30 |
To understand it in better way you can Try it yourself.
Copyright © tutorialspoint.com