jsfiddle-console example

https://github.com/eu81273/jsfiddle-console

HTML

<script src="https://cdn.jsdelivr.net/gh/eu81273/jsfiddle-console/console.js"></script>

JavaScript

var startDate = new Date("01-10-2020");
var endDate = new Date("01-20-2020");
var nextDay = new Date(startDate);
var cnt = 0;
do {
    /*if (nextDay.getDay() >= 1 && nextDay.getDay() <= 5) {
        cnt = cnt + 1;
    }*/
    cnt += (nextDay.getDay() >= 1 && nextDay.getDay() <= 5) ? 1 : 0;
    nextDay.setDate(nextDay.getDate() + 1);
} while (nextDay <= endDate);
console.log("Number of week days between " + startDate + " and " + endDate + " = " + cnt);