var tag = 3;
var stack = [1, 2, 3, 4, 5, 3, 2, 4, 55, 3, 4, 3];
var results = [];
for (var i = 0 ; i < stack.length ; i++) {
if(stack[i] == tag) {
results.push(i);
}
}
var results = stack.map((_, indice) => indice).filter(i => stack[i] == tag);
var results = stack.reduce((arr, x, i) => x == tag ? arr.concat(i) : arr, []);