Last active
August 29, 2015 14:21
-
-
Save rs77/b2c51c943e3b3926a8fa to your computer and use it in GitHub Desktop.
This function is handy when working within Google Apps Script for Spreadsheets are you are operating with a 2-dimensional array. If you need to pop out an element within an array then this function works best. Need to use the array ".filter" method and call the removeElem callback function passing in the arguments as the second parameter: (In fa…
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 removeElem( el ) { | |
return !~el.indexOf( this.val ); | |
} | |
// for example: | |
var arr = [ [ 18, "AAA" ], [ 19, "BBB" ], [ 20, "CCC" ] ]; | |
var query = 19; | |
console.log( arr.filter( removeElem, { val: query } ) ); // returns [[18, "AAA"],[20,"CCC"]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment