On a website to cast a resume, the company has more than one to check, compare which companies have been cast, a little time,
Write a small query to find out if the ready delivery company is in the cast list:
<input type= "text" placeholder= "Please enter company name" id= "Companies"/>
<script type= "Text/javascript" >
function S (FN) {
Return fn.tostring (). Split (' \ n '). Slice (1,-1). Join (' \ n ') + ' \ n ';
}
var str=s (function () {
Fei Grouda
Asian Union
Ping An good room-important member of Ping an group
Safe, good car.
Ping An financial technology
Ocean Terminal
Only the product will
Delicious 77
Pun Shan Chau Club
Iqiyi Art
Site Navigation
UnionPay Business
Shentong Fish Fish Information
Easy Media
ePRO Payment
Are you hungry?
Housing
Day loan
Cool Fun
Medium and software
Schneider
Lou Kou E-commerce
Investing in the people's Treasure
Beep, beep.
Elf Net
Sohu Group
Oriental Wealth
Room Shanghai Research and Development Center
Tradehero
Darbond
Volkswagen Reviews Web
Easy Jump Move
New Real Digital
Pat Loan
ping++
Ndpmedia
Takeaway Superman
Cool Fun
What doing}),
Arr=str.replace (/^\s+|\s+$/g, "). Replace (/\S+/GM," "). Split (" ");
var companyinput=document.queryselector ("#company");
Companyinput.onblur=function () {
var txt=companyinput.value.replace (/^\s+|\s+$/g, "). Replace (/\S+/GM," "),
Len=arr.length,
Max=math.ceil (LEN/2);
Console.time ("Timmer1");
for (var i=0; i<len; i++) {
if (arr[i]==txt) {
Console.log (TXT);
Break
}
}
Console.timeend ("Timmer1");
Console.time ("Timmer");
for (var i=0;i<max; i++) {
if (arr[len-i]==txt| | Arr[i]==txt) {
Console.log (TXT);
Break
}
}
Console.timeend ("Timmer");
}
Would like to make the query a little faster, take half the length, the end of the same time contrast, test down, so slower
Whether the query string already exists