JSFiddle - React, Tailwind, and code Playground
by Michael Darmanin
HTML
<div id="choice"></div>
<div id="hidden">
</div>
CSS
#hidden {display:none}
JavaScript
function searchNames(logins){
var str = "_";
for (var i = 0; i != logins.length; i++) {
var substring = logins[i];
if (str.indexOf(substring) != - 1) {
return substring;
}
}
return null;
}
document.getElementById('choice').innerHTML = searchNames([ [ "marco", "[email protected]" ], [ "john", "[email protected]" ] ]);
//should output [ [ "bar_", "[email protected]" ] ]