Skip to content

Instantly share code, notes, and snippets.

@tcarrio
Last active December 21, 2015 18:18
Show Gist options
  • Save tcarrio/3eea113b9dc00a856028 to your computer and use it in GitHub Desktop.
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
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