JSFiddle - React, Tailwind, and code Playground

by prozoroff

JavaScript

function foo(){
var a = [1,2,3,2,5];
var result = 0;
a.map(function(el){
if(el == 2 ){
result += 2;
return false;
}
});
return result;
}

alert(foo());