How to set a limit for zoom in / out feature?

Hi. I used the technique below. Therefore, I can dynamically set the minimum zoom level

 var initialCountries = [...new Set(markerPoints.map(e => e.country))];
    var initialLat= 55.4414;
    var initialLon= 65.3181;
    var initialZoom = 2;

    if (initialCountries.length === 1){
      initialLat = markerPoints[0].lat;
      initialLon = markerPoints[0].lon;
      initialZoom = 3; 
    }

myPlot.on('plotly_relayout',(e)=>{
    var zoom_level = e['mapbox.zoom'];
    if (zoom_level < initialZoom){
      layout.mapbox.zoom = initialZoom
      layout.mapbox.center = {lat: initialLat, lon: initialLon}
      Plotly.relayout(myPlot, layout)
    }
  })