D
Size: a a a
D
BB
КК
D
AK
BB
КК
D
КК
DF
DF
КК
КК
'use strict';
const players = [
{name: 'pl1', act: true},
{name: 'pl2', act: false},
{name: 'pl3', act: true},
{name: 'pl4', act: false},
{name: 'pl5', act: true}
];
const actAFoolxD = (target) => {
let tmpIndex = null;
const result = players.find(({ name, act }, index) => {
if (tmpIndex !== null && act) return true;
if (target === name) tmpIndex = index;
return false;
});
return result;
};
console.log( actAFoolxD('pl2') );
КК
О
D
VP
VP
VP