First and Last vowel character Strings
As a Logic building Leaner you are given the task to extract the string which has vowel as
the first and last characters from the given array of Strings
Step1: Scan through the array of srings, Extract the Strings with first and last characters as
vowels; these strings should be concatenated
Step2: convert the concatenated string to lower case and return it
If none of the strings in the array has first and last character as vowel, then return no
matches found
Prototype: String findString VowelFirstAndLast(int input1, String input2)
input1: an integer representing the number of elements in the array.
input2: String array
Example-1
input1:3
input2: ["oreo", "sirish", "apple")
output: oreoapple
Example - 2
input1:2
input2: "Mango" "banana")
output: no matches found
Explanation: None of the strings has first and last character as vowel.
Hence the output is no matches found
Plz answer the question now.
Answers
Answer:
Whew that was hard
Okay.... so answer is below
Explanation:
```js
function check(params) {
const vowels =['a', 'e', 'i', 'o', 'u']
var arr
params.some(elem =>{
elem.toLowerCase();
elem.split('')
if(vowels.includes(elem[0])){
if(vowels.includes(elem[elem.length+1])){
arr.push(elem)
}
}
})
console.log(arr)
}
const input1 = ["oreo", "sirish", "apple"]
check(input1)
const input2 = ["Mango", "banana"]
check(input2)
```
Answer:
First and Last vowel character Strings As a Logic building Leaner you are given the task to extract the string which has vowel
as the first and last characters from the given array of Strings
Step 1: Scan through the array of srings, Extract the Strings with first and last characters as vowels; these strings should be concatenated
Step2: convert the concatenated string to lower case and return it If none of the strings in the array has first and last character as vowel, then
matches found
Prototype: String findString VowelFirstAndLast(int input1, String[] input2) input1: an integer representing the number of elements in the array. input2: String array.
Example- 1
input1:3 input2: ("oreo", "sirish", "apple"] output: oreoapple
Example - 2
input1: 2
input2: ("Mango", "banana") output: no matches found
Explanation: None of the strings has first and last character as vowel. Hence the output is no matches found.
Example - 3
input1:3
input2 :["Ate","Ace", "Girl"]