JavaScriptnのfilter
const words = ['a', 'aa', 'spray', 'limit', 'elite', 'exuberant', 'destruction', 'present']; const result = words.filter(word => { var option = word.length > 6 ? true : word.length === 1 console.log(option) return option });
要は、filterの引数で受けている関数で、Arrayの要素ひとつひとつを
trueかfalseかを判断していて、
要素をfalseだった場合は、そのArrayから抜いて、trueだったものを新しくArrayに入れて返すということか。