JavaScript program error: Cannot use ' on ' operator to search

Source: Internet
Author: User

Today, when programming, the JavaScript program reported the error: cannot use ' in ' operator to search for ..., the specific error message is as follows: Frankly, such errors are the hardest to debug. Because it does not point to the specific code you write, but to the general point of the Lib.js file (which is usually a third-party packaged compression library), you can hardly locate the wrong location in actual programming based on the type of error and the error point. What to do? This time, only play "Dead knock" spirit! Dead Knock Steps:
    1. It should be easy to locate the wrong file based on the fault page and the error message;
    2. In the error page, click Debug, then look at which step began to error! It's critical! For example, at the beginning of the load error, then locate the initialization of the JS file, click on a button error, then locate the button's corresponding event code, and so on.
    3. In the code range of the positioning, using the "compromise method", a little comment out, refresh the page to see if there is still error, if the error, this means that commented out part of the code is not a problem, let go of the comments, continue other suspicious code part; If there is no error, congratulations, your location is more refined! The general idea is so, the cycle, I believe, there will always be "to clear the clouds to see the blue sky" of joy!

1 console.log (' rendernerererer: ', Schooldata)23 Const Schoolnode = ( 4     <select style={{width: ' 100% '}} placeholder= "Please select your school" >5         {schooldata.length && Schooldata.map (item, IDX) = (6             <option key={idx} value={' ${item.id} '}>{ Item.name}</option>7)        }8     </Select>9 );

As you can see, Rendernerererer is printed correctly, and the problem follows the line code:

  1  Const SCHOOLDATA = this  .state.schoollist;   2  console.log (' rendernerererer: '  6  {schooldata.length? schooldata.map (item, IDX) => (  7  <option Key={idx} value={' ${item.id} '}>{i Tem.name}</option> 8 ): <option value= ' > Please select ...</option>}  9  </select>10 ); 

1Const SCHOOLDATA = This. state.schoollist;2Console.log (' Rendernerererer: ', Schooldata)3  4Const SCHOOLNODE = (5<select style={{width: ' 100% '}} placeholder= "Please select your school" >6{schooldata.length? schooldata.map (item, idx) = = (7<option key={idx} value={' ${item.id} '}>{item.name}</option>8)) :NULL }9</Select>Ten);

JavaScript program error: Cannot use ' on ' operator to search

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.