how to get the fist characters of an array in javascript code example
Example: Check first character of string in array and compare to another array
a = ['ghis', 'rs', 'ea','eat' ,'nentence']
let word = ''
function check(arr){
let color = ['green']
for(let i = 0; i < arr.length;i++){
word += arr[i][0]
}
for(let j = 0;j < color.length;j++){
if(word == color[j]){
return true
}
}
return false
}
console.log(check(a))