function getDivisorsCnt(n){
let counter = 0
for (let val=1; val<=n; val++){
if (n % val === 0 ){
counter +=1
}
}
return counter;
}
console.log(getDivisorsCnt(12))
<script src='https://path_to_your_script/your_script.js></script>
<script src='//path_to_your_script/your_script.js></script>