“filtrage en javascript” Réponses codées

filtre JavaScript

const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => word.length < 6);

console.log(result);

//OUTPUT: ['spray', 'limit', 'elite']
Moscode

Filtre le tableau JavaScript

var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => word.length > 6);

console.log(result);
White Browed Owl

filtre JavaScript

const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];

const filter = arr.filter((number) => number > 5);
console.log(filter); // [6, 7, 8, 9]

or 

const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => word.length > 6);

console.log(result);
// expected output: Array ["exuberant", "destruction", "present"]
Aggressive Albatross

filtre en js

const filterThisArray = ["a","b","c","d","e"] 
console.log(filterThisArray) // Array(5) [ "a","b","c","d","e" ]

const filteredThatArray = filterThisArray.filter((item) => item!=="e")
console.log(filteredThatArray) // Array(4) [ "a","b","c","d" ]
D@RK$T@R

filtre JavaScript

const myNum = [2,3,4,5,6,7,8,9,10];
//using filter gives us a new array
const divisibleBy3 = myNum.filter(eachNum => eachNum%3==0); 
console.log(divisibleBy3); //output:[3,6,9]
Aggressive Antelope

filtrage en javascript

  //filter numbers divisible by 2 or any other digit using modulo operator; %
  
  const figures = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  const divisibleByTwo = figures.filter((num) => {
    return num % 2 === 0;
  });
  console.log(divisibleByTwo);
Fierce Fox

Réponses similaires à “filtrage en javascript”

Questions similaires à “filtrage en javascript”

Plus de réponses similaires à “filtrage en javascript” dans JavaScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code