“Tablica filtra JavaScript” Kod odpowiedzi

Filtr 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

Filtruj tablicę JavaScript

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

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

console.log(result);
White Browed Owl

.filter JS

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"]
Difficult Dolphin

Jak działa funkcja Filter () 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]
DCmax1k

Filtr JavaScript

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

const threeLetterWords = words.filter(word => word.length <= 5)

console.log(threeLetterWords);

// RESULT: (3) ["spray", "limit", "elite"]
Jack Stevens

Tablica filtra JavaScript

let bigCities = cities.filter(city => city.population > 3000000);
console.log(bigCities);Code language: JavaScript (javascript)
Ugly Unicorn

Odpowiedzi podobne do “Tablica filtra JavaScript”

Pytania podobne do “Tablica filtra JavaScript”

Więcej pokrewnych odpowiedzi na “Tablica filtra JavaScript” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu