Js ako odstrániť prvok z poľa

Príklady kódu

217
0

N

var colors = ["red","blue","car","green"];
var carIndex = colors.indexOf("car");//get  "car" index
//remove car from the colors array
colors.splice(carIndex, 1); // colors = ["red","blue","green"]
0
0

N

let myArray = [3, 1, 4, 1, 5, 2];
let unwantedElementIndex = 3;

// This line removes 1 element from the array, starting at the unwantedElementIndex
myArray.splice(unwantedElementIndex, 1);

// If you have your custom test to remove an element just go for 
// Higher-Order functions
let myArray = ["[email protected]", "wrong@[email protected]", "..."];
const emailRegexp = ____;
let allCorrectEmails = myArray.filter(element => emailRegexp.test(element));

V iných jazykoch

Táto stránka je v iných jazykoch

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................