JavaScript 入門 forループ + of でインデックスが欲しい場合

以下のようにfor文でofを使っているときに、ループのインデックスが欲しい時があります。

const myArray = [{name: 'AAA'}, {name: 'BBB'}, {name: 'CCC'}];

for(const value of myArray){
	console.log(value);
}

Array.prototype.entries を使うと以下のようにかけます。

const myArray = [{name: 'AAA'}, {name: 'BBB'}, {name: 'CCC'}];

for(const [index, value] of myArray.entries()){
	console.log(index);
  console.log(value);
}