How do I find the position of a string in an array when the member of the js array is an object?

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
        //
        function test1() {
            var divs = document.querySelectorAll("div");
            arr = Array.prototype.slice.call(divs);

            var locationArr = [];
            for (var i = 0; i < arr.length; iPP) {
                if (arr[i].indexOf("li") >= 0) {
                    locationArr.push(i);
                }
            }
            console.log(arr);
            console.log(locationArr); //     
            
        }
        
        //
        function test2() {
            var arr = ["zhao", "qian", "sun", "li", "zhou"];
            var locationArr = [];
            for (var i = 0; i < arr.length; iPP) {
                if (arr[i].indexOf("li") >= 0) {
                    locationArr.push(i);
                }
            }
            console.log(arr);
            console.log(locationArr); //         
        }
        
        
    
    </script>
</head>
<body>

<button onclick="test1()"></button>
<button onclick="test2()"></button>

<div id="rongqi">
    <div>zhao</div>
    <div>qian</div>
    <div>sun</div>
    <div>li</div>
    <div>zhou</div>    
</div>
</body>
</html>
Mar.29,2021

tagName localName nodeName
is nothing more than comparing this thing.


you can actually repeat your detailed requirements. If you look at the code, you basically don't use it this way. What you should struggle with is the direction of coding. You feel that your thinking is incorrect

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea9c01-46a00.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea9c01-46a00.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?