JSFiddle - React, Tailwind, and code Playground

JavaScript

function lastBusinessDayOfMonth(year, month) {
    var date = new Date();
    var offset = 0;
    var result = null;
    
    if ('undefined' === typeof year || null === year) {
        year = date.getFullYear();
    }
    
    if ('undefined' === typeof month || null === month) {
        month = date.getMonth();
    }

    do {
        result = new Date(year, month, offset);
        
        offset--;
    } while (0 === result.getDay() || 6 === result.getDay());

    return result;
}
var event = lastBusinessDayOfMonth(1,2018)

var options = {  year: 'numeric', month: 'numeric', day: 'numeric' };

alert(event.toLocaleDateString('nl-NL', options));