title: nknown error: Runtime.evaluate threw exception: SyntaxError: Unexpected token var
body: <p>I have this code:</p>
  
  <pre><code>        JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
  //        javascriptExecutor.executeScript("W.setOffer({offer: {kind: \"coupon\", title: \"Hello\", availability: " +
  //                "\"available\"}},{})");
  
          String script =
                  "var aLocation = {}" +
                          "var aOffer = {}" +
                          "var aAdData = " +
                          "{ " +
                          "location:  aLocation, " +
                          "offer:    aOffer " +
                          " } " +
  
                          "var aClientEnv = " +
                          " { " +
                          "    sessionid:     “”, " +
                          "   cookie:        “”, " +
                          "   “rtserver-id”: 1,   " +
                          "       lon:           34.847, " +
                          "       lat:           32.123, " +
                          "       venue:         “”, " +
                          "    venue_context: “”, " +
                          //   AD-{"campaignId":8224,"offerId":4172}
                          // see Venue Context for more information.
  
                          "    source:        “”," +   // One of the following (string) values: ADS_PIN_INFO,
                          // ADS_0SPEED_INFO, ADS_LINE_SEARCH_INFO,
                          // ADS_ARROW_NEARBY_INFO, ADS_CATEGORY_AUTOCOMPLETE_INFO,
                          // ADS_HISTORY_LIST_INFO
                          // (this field is also called “channel”)
  
                          "    locale:        “”" + // ISO639-1 language code (2-5 characters), supported formats:
                          // * en/he/fr/…
                          // * en-GB/pt-BR/en_GB/pt_BR
                          // * es-419/es_419
                          " } " +
  
  
                          "W.setOffer(aAdData, aClientEnv);";
  
          javascriptExecutor.executeScript(script);
      }
  </code></pre>
  
  <p>but it fails on the <code>executeScript</code></p>
  
  <pre><code>org.openqa.selenium.WebDriverException: unknown error: Runtime.evaluate threw exception: SyntaxError: Unexpected token var
  (Session info: chrome=42.0.2298.0)
    (Driver info: chromedriver=2.9.248307,platform=Mac OS X 10.9.5 x86_64) (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 18 milliseconds
  </code></pre>
  
  <p>here is the script. Am I missing something?</p>
  
  <p>cannot I use <code>var</code> to save an element?</p>
  
  <pre><code>var aLocation = {}
  var aOffer = {}
  var aAdData = {
      location: aLocation,
      offer: aOffer
  }
  var aClientEnv = {
      sessionid: “”,
      cookie: “”,
      “rtserver - id”: 1,
      lon: 34.847,
      lat: 32.123,
      venue: “”,
      venue_context: “”,
      source: “”,
      locale: “”
  }
  W.setOffer(aAdData, aClientEnv);
  </code></pre>