First of all, what is frequency?
According to Wikipedia, it's" the rate at which something occurs over a particular period of time or in a given sa...
For further actions, you may consider blocking this person and/or reporting abuse
There's no need for
nums.map(e => Number(e))
. Here, you are transforming numbers to... well, numbers. You can skip this step. If you really want to convert them to strings you should use eitherString(e)
ore.toString()
.I'm sorry It's a typo, I originally wanted to write String(e). Thanks for pointing out to me
You can change
Number(e)
with+e
Thats too hacky and non intuitive i.e. not readable. As a simple rule you must avoid being clever because readable code is always better than clever code 😊
True, simple code is good code.
Thanks for the pointer.
We could just use
Array.reduce
Yeah, there's more that one way to skin a cat
Thanks!
Wow thanks, that's awesome and shorter
no problems, keep learning !
Why would you need to do this any differently for numbers vs strings?? The first example (the one that you show as being "for string elements") works just fine if you pass in the array of numbers.
Wow, I never realized that. Thanks for the pointer, I'll the remove the 'For numbers' part.
Ngl the "for numbers" part is stupid
That I agree with, thanks for your feedback
Thanks for this. This is good for beginners like me as it says in the tags. Some of the other suggestions are cool too but a bit more confusing :)