How can I get the index of any array having 'AAPL' in the following example code? The following code returned true or false. Instead of true or false, how can I get 0 and 2? Thanks for any help!
function test() {
var tickers = [], isAAPL = [];
tickers[0] = 'AAPL';
tickers[1] = 'GOOG';
tickers[2] = 'AAPL';
tickers[3] = 'MSFT';
// how to find the index of the array containing 'AAPL'? The output should be 0 and 2.
isAAPL = tickers.map(x => (x == 'AAPL'));
console.log(isAAPL);
}