Select to view content in your preferred language

What is wrong with my syntax?

3978
12
Jump to solution
07-17-2015 08:38 AM
ChrisSergent
Deactivated User

I want to use the findAddress Candidates, but I am receiving a syntax error. What do I need to modify?

<script>
         require(["esri/tasks/AddressCandidate",
                   "dojo/_base/array"], function (AddressCandidate,array) {
                       on(dom.byId("btnTest"),"click",function() {
                           array.forEach(addressCandidates, function(candidate) {
                               if (candidate.score > score && candidate.attributes.Loc_name === document.getElementById("ownerAddress").value) {
                                   stop = candidate;
                                   score = candidate.score;
                                   // Display the score on the console.
                                   console.log = score;
                               }
                           })
                    });
                           
                                   
     </script>

And the AddressCandidate code sample appear to be incomplete. What else do I need besides what they show. I figure my addressLocator; anything else?

Here is my updated code: csergent45/codeViolationNotice at 3cd51e07008dfb3882231ba9f252d81dbef05bae · GitHub

0 Kudos
12 Replies
RobertScheitlin__GISP
MVP Emeritus

Chris,

   That's why I like to use a IDE like Brackets with the Interactive linter extension. So that I never even have to leave my IDE or click a button to lint my app. There are many IDEs out there with linting but brackets is my choice.

ChrisSergent
Deactivated User

I use Visual Studio and I had Lint on it once, but it found a lot of errors with the JavaScript API and/or jQuery. Is there a way to make it exclude files?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Chris,

   I am not familiar with VS linting add-ons but in most linters you just use directives like this in your JS code:

/*global define, dojo, console, window, setTimeout*/

/*jslint maxlen: 800, -W116 */

0 Kudos