Junior — Middle+
Checking for a subsequence in a string
livecode
Task condition
It is necessary to implement a function that determines whether the characters of one string appear in another string in the same order, but not necessarily contiguously.
function isSubsequence(pattern, text) {
return false;
}
// Usage examples:
isSubsequence('whe', 'cartwheel') // true
isSubsequence('crt', 'cartwheel') // true
isSubsequence('ctr', 'cartwheel') // false
isSubsequence('weee', 'cartwheel') // false