In the console when I type windows.find("text")
it gives me "true" or "false", which is good.
To make my job easier in checking if a list of items is present in a webpage, I want to make a script in the console
var mylist = ["text1", "text2", "text3"]
for i=0, i<mylist.length, i++* if windows.find(mylist[i])
Could you please help me with the syntax? Is my approach correct?
I guess something like
var mylist = ["text1", "text2", "text3"];
for(var val of mylist){
if(window.find(val)) console.log(val);
}
Should do the trick? In chrome you should be able to just paste it in etc.
Edit: Adding none ES6 example also
var mylist = ["text1", "text2", "text3"];
for (var i=0;i<mylist.length;i++){
if(window.find(mylist[i])) console.log(mylist[i]);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.