“Was ist Index in JavaScript?” Code-Antworten

JavaScript Indexof

//indexOf getting index of array element, returns -1 if not found
var colors=["red","green","blue"];
var pos=colors.indexOf("blue");//2

//indexOf getting index of sub string, returns -1 if not found
var str = "We got a poop cleanup on isle 4.";
var strPos = str.indexOf("poop");//9
Grepper

JavaScript Index mit Bedingung

a = [
  {prop1:"abc",prop2:"qwe"},
  {prop1:"bnmb",prop2:"yutu"},
  {prop1:"zxvz",prop2:"qwrq"}
];
    
index = a.findIndex(x => x.prop2 ==="yutu");

console.log(index);
Clever Crane

.Index von JavaScript

let monTableau = ['un', 'deux','trois', 'quatre'] ;
console.log(monTableau.indexOf('trois')) ;
 
Crevure 01

INDEXOF JS

const fruits = ["apple", "banana", "cantaloupe", "blueberries", "grapefruit"];

const index = fruits.findIndex(fruit => fruit === "blueberries");

console.log(index); // 3
console.log(fruits[index]); // blueberries
Breakable Bug

JS, Indexof ();

function quickCheck(arr, elem) {
  return arr.indexOf(elem) != -1;
}
console.log(quickCheck(["squash", "onions", "shallots"], "mushrooms"));
Condemned Cheetah

Ähnliche Antworten wie “Was ist Index in JavaScript?”

Fragen ähnlich wie “Was ist Index in JavaScript?”

Weitere verwandte Antworten zu “Was ist Index in JavaScript?” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen