Longest Subsequence of a String containing only Consonants | Returns true if x is consonants . ; Function to check whether a character is consonants or not ; Function to find the longest subsequence which contain all consonants ; Driver code ; Function call
function isConsonants ( x ) { x = x . toLowerCase ( ) ; return ! ( x === " " x === " " x === " " x === " " x === " " ) ; } function longestConsonantsSubsequence ( str ) { var answer = " " ; var n = str . length ; for ( var i = 0 ; i < n ; i ++ ) { if ( isConsonants ( str [ i ] ) ) { answer += str [ i ] ; } } return answer ; } var str = " " ; document . write ( longestConsonantsSubsequence ( str ) + " " ) ;