Hi, I’m trying to remove empty strings from this converted string to array problem.
Previously I’ve done removing the empty strings from array by
filter() property like the below code.
var n = ["hi", , "what"]; console.log(n); var y = n.filter(Boolean); console.log(y);
But now on this problem which is required to convert from string array first and then remove the empty string from it. I tried with the below code. but it’s not removing the empty strings.
var s = "Hello world, how you doin?"; var a = s.split(""); console.log(a); a.sort(); var x = a.filter(Boolean); console.log(x);
I appreciate your help! Gracious.