392. Is Subsequence (Javascript)
Hi, I solved the Leetcode problem 392.
It's about comparing two strings.
s should be a subsequence of t, and we have to consider the order,
but the characters in s can appear separately within t.
To summarize, it's just about checking if s is a subsequence.
Please read the description.
Why is the first example 'true'?
It's because s is a subsequence of t,
even if the characters are not contiguous.
However, in Example 2,
the output is false
because there is no 'x'."
here is my solution
I just need to check if the factor of s consists of t or not.
So, I used the for loop and lf statement for comparing the both of factors.
and declared a variable outside the for loop, because for processing the for loop statement, the variable should be changed.
Then, I plan to use a ternary operator in the return part.