I\'m using Mapbox GL JS v0.14.2 and I\'ve searched high and low through the documentation and very little is clear about this.
If you use the standard JS API, it\'s
For a solution that will work for all GeoJSON objects, not just a set of markers, check out Mapbox's Turf.js.
This code was very helpful to me: https://bl.ocks.org/danswick/83a8ddff7fb9193176a975a02a896792
But just to repeat the basics in case that link dies:
var bounds = turf.bbox(markers);
map.fitBounds(bounds, {padding: 20});
The extent method mentioned in the linked code has been deprecated in favour of bbox, but the result is the same.