O'Reilly logo

OpenLayers 3 : Beginner's Guide by Erik Hazzard, Paul Spencer, Thomas Gratier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating object literals

We will introduce object literals and get acclimated with how to manipulate them now, so that we can better work with the OpenLayers code:

  1. Open up Chrome and the DevTools Console panel—again, it doesn't matter right now what page you're on.
  2. Type in the following code, and then execute it by pressing Enter:
    var my_parameters = {zoom: false, attribution: false, otherControl: 'myslider'};
    console.log(my_parameters);
  3. The preceding code should display, in the console log area, something similar to {zoom: false, attribution: false; otherControl: 'mySlider'}. In this case, the object is not complex but when the object is more complex, you will see an arrow before the object, and if you click on it, it will show ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required