You can't accurately, without a lot of external information.
To calculate the basic working days count (without holidays, and assuming Monday to Friday only):
function getDaysInMonth(iMonth, iYear)
{
return 32 - new Date(iYear, iMonth, 32).getDate();
}
function isWorkDay(year, month, day)
{
var dayOfWeek = new Date(year, month, day).getDay();
return dayOfWeek >=1 && day <=5;
}
function getWorkDays(month, year)
{
var days = getDaysInMonth(month, year);
var workdays = 0;
for(var i = 0; i < days; i++)
{
if (isWorkDay(year, month, i+1))
{
workdays++;
}
}
return workdays;
}
The problem is that that does not give you an accurate count - you also need to allow for holidays, and working those out is a lot harder, and will vary from region to region.