Skip to content

Commit b92a9e3

Browse files
authored
Update README.md
1 parent b783cc7 commit b92a9e3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

L-B/0014 stringCheck/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
## You are given an array with two strings. Write a function to check all the letters present in the second string is also present in the first string,ignoring the case.The function should return a boolean.
22
### eg: stringCheck(["React","cat"]) should return true
33
### stringCheck(["tab","tan"]) should return false
4+
5+
# Explanation
6+
## first create a function that takes an array as argument.
7+
## create a variables 'flag' with a value of zero.
8+
## create two variables string1 and string2 from the first and second element of the array.
9+
### eg: let myArray=["cat","dog"]
10+
### let string1=myArray[0] that is "cat"
11+
### let string2=myArray[1] that is "dog"
12+
### Loop through each letters of string2 with a for loop and check the letters present in string1 by a ".includes()" function in javascript.If any of the letter in string2 is not present in string1 we have to add 1 to our 'flag' variable.Finally we use if condition to check the flag variable.If flag is zero that means all the letters of the string2 are present in string1, and return true. if flag is greater than zero , that means some letters are not present, so we retun false.
13+
14+
## Problem added by
15+
### Fais Edathil [Git Hub](https://github.com/E-fais)
16+

0 commit comments

Comments
 (0)