Check values in the Array is a String
Given an array
Sample Input 1
[ 'frozen', 'rock', 'stained', 'basket' ]
Sample Output 1
true
Sample Input 2
[ 'recycling', 70, 'pastime', 'animal' ]
Sample Output 2
false
let arr = [ 'recycling', 70, 'pastime', 'animal' ];
let result = arr.every(function(value) {
return "string" === typeof value
});
console.log(result);
Comments
Leave a comment