JSFiddle - React, Tailwind, and code Playground
JavaScript
var Str2 = function (strs, str) {
var i, a = 0;
for (i = 0; i < strs.length; i++) {
if (str == strs[i]) {
a = a + 1;
if (a > 1) return "true";
}
}
return "false";
}
var teste1 = Str2(["a", "b", "a", "c"], "c"); //=> "false"
var teste2 = Str2(["a", "b", "a", "c"], "a"); //=> "true"
console.log(teste1, teste2);