I am struggling with a coding challenge where I need to count how many times a character appears in a string and then store that information in a variable. This variable will hold the character along with the number of times it occurs in the string.
For instance:
var greeting = "Hello World";
[H] appears [1] time.
[e] appears [1] time.
[l] appears [3] times.
[o] appears [2] times.
[W] appears [1] time.
[r] appears [1] time.
[d] appears [1] time.
Despite following various guides and tutorials, I find this task challenging as a beginner in JavaScript. Any tips or guidance on how to approach this problem would be greatly appreciated.
Thank you!