Last active
December 21, 2015 18:18
-
-
Save tcarrio/3eea113b9dc00a856028 to your computer and use it in GitHub Desktop.
Drive add-on to return array of values from second array where array ones corresponding index contained the specified char
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function selectRangeByCorrespondingChar(c1,c2,char) { | |
var n=[], c=0; | |
for(var i in c1){ | |
if(i===char){ | |
n.push(c2[c]); | |
} c++; | |
} | |
return n; | |
} | |
function sumRangeResult(c1) { | |
var t=0; | |
for(var n in c1){ | |
t+=n; | |
} return t; | |
} | |
function processRange(a,b,c) { | |
return sumRangeResult(selectRangeByCorrespondingChar(a,b,c)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment