统计以下语句中,出现最多的单词

var str = 'i like code and writing code makes me feel charming';
var array = str.split(" ").reduce((prev, next) => (prev[next]++ || (prev[next] = 1), prev), {})

 

posted @ 2022-02-17 19:47  木木的奇奇  阅读(25)  评论(0编辑  收藏  举报