Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

filter 2d array javascript

function filterByPosition(array, number, position) {
   return array.filter(innerArray => innerArray[position - 1] !== number);
}

const items = [
  [1, 1, 2, 4],
  [2, 1, 4, 6],
  [5, 6, 4, 1],
  [1, 6, 3, 1]
];

const newItems1 = filterByPosition(items, 1, 2);
console.log('Items1:', newItems1);

const newItems2 = filterByPosition(items, 4, 3);
console.log('Items2:', newItems2);
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript dom methods list 
Javascript :: set methods in js 
Javascript :: insertbefore javascript 
Javascript :: dark mode javascript 
Javascript :: types of method in js 
Javascript :: check identical array javascript 
Javascript :: add a string to list jquery 
Javascript :: javascript string mutable 
Javascript :: images node backend server 
Javascript :: favicon express js 
Javascript :: fetch log api response time 
Javascript :: socket io stream 
Javascript :: how to defined an array in js 
Javascript :: formidable form node js 
Javascript :: 35,2 + 29,4 
Javascript :: react copy array 
Python :: tkinter how to make a root non rezizable 
Python :: doublespace in python 
Python :: check python version colab 
Python :: python order dataframe according to date time 
Python :: save thing in pickle python 
Python :: remove column from df 
Python :: use nltk to remove stop words 
Python :: python delay 
Python :: colab im show 
Python :: make tkinter btn disable 
Python :: url decode python 
Python :: python datetime string 
Python :: Getting Random rows in dataframe 
Python :: python everything after last slash 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =