I have tried to get the hang of JavaScript. I am still working on the basics. I understand arrays, but functions and objects have been…