Im trying to add two conditions in filter but only one works. The first condition check if it has empty spaces between words and the second condition if words.length is bigger t
Seems like you want to filter if sumOfWord is not empty and its length is greater than minLength. @Barmar suggests you the good solution, use the following code.
let wordsLength = sumOfSentence.split(" ");
let longWords = wordsLength.filter(function(sumOfWord){
return ((sumOfWord.trim() != '') && sumOfWord.length >= minLength)
});