Filters combinations based on whether they end with a specified string or not.

@param {WordCombination[]} wordCombinations The array of WordCombinations to filter.
@param {string} str The string the WordCombinations that need to be filtered out end with.
@param {string[]} exceptions The array of strings containing exceptions to not filter.
@returns {WordCombination[]} The filtered array of WordCombinations.
function filterEndingWith( wordCombinations, str, exceptions ) {
	wordCombinations = wordCombinations.filter( function( combination ) {
		const combinationstr = combination.getCombination();
		for ( let i = 0; i < exceptions.length; i++ ) {
			if ( combinationstr.endsWith( exceptions[ i ] ) ) {
				return true;
			}
		}
		return ! combinationstr.endsWith( str );
	} );
	return wordCombinations;
}