例題 与えられた文章に対し、単語の数を数え上げる関数を作ってみましょう。 ある一つの単語ではなく、出てくる単語全部について数えます。 function countWords (text) { // ??? } const text = 'base base kick kick base kick kick' const counts = countWords(text) console.log(counts) // -> 'base'が3個!'kick'が4個! function countWords (text) { const words = text.split(' ') // 単語と数のペアを並べた配列をこれから作っていきます。 // 例:[['base', 3], ['kick', 4]] const wordAndCountPairs = [] for (const word