+ 1
Function
what this command do arr.indexof(x)
9 odpowiedzi
+ 1
9 is not present in the array.
(index <0)? 1: 0; is a ternary operator.
Some people consider it as shorthand if/else.
What the code is saying
if (index < 0){
result = 1;
}else{
result = 0;
}
0
finds the index value of the argument in an array.
0
I don't understand look this code
0
What is the output of this code?
var arr = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8];
var index = arr.indexOf(9);
var result = index < 0 ? 1 : 0;
console.log(result);
0
thanks
0
a[I] showing the value of the index
a.indexof(x) showing the index of the value
0
thank you so much for help
0
😂😂glad to help👍.