Hash from two arrays: Difference between revisions

Added Wren
No edit summary
(Added Wren)
Line 2,196:
{{out|Returns}}
<pre>{a 1 b 2 c 3}</pre>
 
=={{header|Wren}}==
Wren's built-in Map class does not guarantee (as here) that iteration order will be the same as the order in which elements were added.
<lang ecmascript>var keys = [1, 2, 3, 4, 5]
var values = ["first", "second", "third", "fourth","fifth"]
var hash = {}
(0..4).each { |i| hash[keys[i]] = values[i] }
System.print(hash)</lang>
 
{{out}}
<pre>
{2: second, 1: first, 3: third, 5: fifth, 4: fourth}
</pre>
 
=={{header|zkl}}==
9,485

edits