Find the largest MODE of an array | JavaScript Fundamentals

preview_player
Показать описание
Learn how to use JavaScript to find the greatest mode in a data set that has multiple modes.

Background music courtesy of Fesliyan Studios

Learn JavaScript with CSX:

Connect with me on Twitter:
Рекомендации по теме
Комментарии
Автор

Thank you for sharing this! Really helped me out A TON!

ChrisTian-oxnr
Автор

I see you don't reply your mesages but you said we should ask questions. Hi, this is a great tutorial. I have a question. What if I want to return the first occurence? Say I want to return the first mode that appear first, which is 2. what I'm I going to do?

OsundareToheeb
Автор

Is key comparison on line 32 really important, if we are looking for highest frequency in values? Testing two mode keys as (-2 and -3) where (-2) is greater than (-3) we get a wrong return of #6 which only has 1 occurrence. I would take out the key comparison from '&&' on and the rest will do fine.

frewnegash
welcome to shbcf.ru