7 kyu
Zip it!
427 of 986joh_pot
Description:
Write
Array.prototype.zip = function (arr, fn) {}
that merges the corresponding elements of two sequences using a specified selector function fn
(a block
in Ruby)
For example:
var a = [1, 2, 3, 4, 5];
var b = ['a','b'];
a.zip(b, (a, b) => a + b) === ['1a', '2b']
var a = [1, 2, 3, 4, 5];
var b = ['a','b','c','d','e'];
a.zip(b, (a, b) => a + b.charCodeAt(0)) === [98, 100, 102, 104, 106]
if arrays have different lengths, go up to the minimum length and then stop.
Arrays
Fundamentals
Similar Kata:
Stats:
Created | Jan 29, 2016 |
Published | Jan 29, 2016 |
Warriors Trained | 2007 |
Total Skips | 143 |
Total Code Submissions | 3519 |
Total Times Completed | 986 |
JavaScript Completions | 427 |
Ruby Completions | 84 |
Python Completions | 398 |
C# Completions | 75 |
C Completions | 71 |
Total Stars | 32 |
% of votes with a positive feedback rating | 90% of 246 |
Total "Very Satisfied" Votes | 209 |
Total "Somewhat Satisfied" Votes | 27 |
Total "Not Satisfied" Votes | 10 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |