Resources
Answers
Examples
Sign in
Get Started
What do you want to save?
Add Code snippet
New code examples
Javascript
2021-09-14 09:41:02
JavaScript Array Methods indexOf()
var array = [2, 9, 9]; array.indexOf(2); // 0 array.indexOf(7); // -1 array.indexOf(9, 2); // 2 array.indexOf(2, -1); // -1 array.indexOf(2, -3); // 0
Add solution
Javascript
2021-09-13 08:12:02
how to remove a value from an array and return the new array in javascript
const array = [2, 5, 9]; console.log(array); const index = array.indexOf(5); if (index > -1) { array.splice(index, 1); } // array = [2, 9] console.log(array);
Add solution
Javascript
2021-09-07 05:20:02
check if object is present in array javascript
var obj = {a: 5}; var array = [obj, "string", 5]; // Must be same object array.indexOf(obj) !== -1 // True
Add solution
Javascript
2021-08-29 08:06:01
find and delete element from array js
const array = [2, 5, 9]; console.log(array); const index = array.indexOf(5); if (index > -1) { array.splice(index, 1); } // array = [2, 9] console.log(array);
Add solution
C#
2021-08-29 00:37:01
unity c# find object position in array
//C# Unity finding an object in an array int positionInArray = System.Array.IndexOf(arrayName, objectToFind);
Add solution
Java
2021-08-27 14:12:02
stairs javascriot
function staircase(n) { let filledArray = new Array(n).fill(' '); while (filledArray.indexOf(' ') !== -1) { filledArray.shift(); filledArray.push('#'); console.log(filledArray.join("")); n--; }}
Add solution
C#
2021-08-27 02:57:01
c# propertyinfo indexof
Array.IndexOf(propInfo.Select(x => x.Name).ToArray() , "name")//...
Add solution
‹
1
2
3
4
›
Best helpers
daily
weekly
monthly
for 3 months
Dee M
+5
Reader
+5
Sdqali
+5
Aerin
+5
Egil
+5
Benstone
+5
Mv Log
+5
Abdullahi saad
+5
WordLover
+5
Janet Walker
+5
Cledoux
+5
NewUser
+5
Mythio
+5
Ohio818
+5
Jay Cossey
+5
show more
This website uses cookies to make IQCode work for you. By using this site, you agree to our
cookie policy
Welcome Back!
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign in
E-mail
Password
Recover lost password
Log in
Or log in with
Not registered?
Sign up takes less than a minute
Create a Free Account
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign up
Email
Password
Sign up for free
Or sign up with
By signing up, you agree to the
Terms and Conditions
and
Privacy Policy
. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.