JS Obtenha o número de classes em HTML

VanillaJS
document.querySelectorAll('#main-div .specific-class').length;

jQuery
$('#main-div .specific-class').length
Blue Duck