We'll wrap up this chapter with a final update to our example by adding a second map and linking the two maps together.
<div> tags; it's the HTML that looks like this:<button onclick="changeTarget();">Change Target</button>
changeTarget(), as we won't need it any more.ol.Map and put it into the map2 <div> tag. Note that there is no view option!var map2 = new ol.Map({
target: 'map2',
layers: [layer]
});view property to the other map object:map2.bindTo('view', map);With a single line of code, we bound the view property of the two maps and were able to produce a pretty interesting effect. By itself, this doesn't do much that could be considered useful but it is the basis for building some interesting functionalities such as creating an overview map or a highlight map that shows the same area as a main map but at a different level of detail.
One thing you probably noticed with the previous example is that changes from one map aren't animated in the other one. This behavior is to be expected. If you recall, we mentioned in the animation section that programmatic changes are applied instantly. Since we aren't adding animation effects with beforeRender(), the changes applied from one view to the other happen instantly and the result is sometimes quite jarring.
Use the knowledge you've gained in this chapter to adapt the previous example into something more useful. Try to make the second map respond to changes in the first map, but zoomed out three times. Remember that zooming out once is equivalent to doubling the zoom level. When the page loads, it should look like this:

When the first map is panned or zoomed, the second map should center on the same location and stay zoomed out in three levels. The second map should not have any controls or interactions—set both the controls and interactions option to new ol.Collection() to achieve this.
Let's do a series of questions to see what you understood during the chapter:
Q1. I want to start my map looking at a specific location and level of detail. Which object is responsible for this?
Q2. I want to take some action when the user pans the map. What event should I listen for?
moveendzoomendQ3. Which object files this event?
Q4. I want to update a property called center of the view object when the center property on another object obj, changes. Which class provides the bindTo() method that I'll use?
ol.Mapol.Viewol.Object