Last Updated : Jan 1, 2023
That’s the reason in this article we are going to show you how to find index of object in array. let us see below.
Inside this article, we are going to use findIndex() function. Let us see how to use this with help of codes given below.
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Here, then we create a body tag. All the content which we want to show on browser’s screen or display is always written inside this codes.
- Inside script here we create an array using a variable name vehicles and we create vehicles with help of constants. Inside this array we create nested arrays means these are multidimensional.
- Here, we creates months and seasons, and gives values inside them. You can see the codes for reference.
- Now, we create another variable named index using constant. Here, we use find index and use properties to find bullet inside array.
- Now, at last we print this value or say answer using console. The output of console will be showed in console method.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.
At last in conclusion, here we can say that with the help of this article we are able to understand how to find index of object in array using property.