Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Hash-from-two-arrays/Jsish/hash-from-two-arrays.jsish
Normal file
20
Task/Hash-from-two-arrays/Jsish/hash-from-two-arrays.jsish
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* Hash from two arrays, in Jsish */
|
||||
function hashTwo(k:array, v:array):object {
|
||||
var hash = {};
|
||||
for (var i = 0; i < k.length; i++) hash[k[i]] = v[i];
|
||||
return hash;
|
||||
}
|
||||
|
||||
;hashTwo(['a','b','c'], [1,2,3]);
|
||||
;hashTwo(['a','b'], [1,[2,4,8],3]);
|
||||
;hashTwo(['a','b','c'], [1,2]);
|
||||
;hashTwo([], []);
|
||||
|
||||
/*
|
||||
=!EXPECTSTART!=
|
||||
hashTwo(['a','b','c'], [1,2,3]) ==> { a:1, b:2, c:3 }
|
||||
hashTwo(['a','b'], [1,[2,4,8],3]) ==> { a:1, b:[ 2, 4, 8 ] }
|
||||
hashTwo(['a','b','c'], [1,2]) ==> { a:1, b:2, c:undefined }
|
||||
hashTwo([], []) ==> {}
|
||||
=!EXPECTEND!=
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue