how to find the number of letters available in the array using java script?
consider there is a paragraph which is written with the array. and there is a search box and a button to find the result. if we search any letter lets say a, and hit on the button it should display the number of a's available in the paragraph below the search box. this is my interview question and I didn't crack it. Here is the code let textArray = [{ "text": "Infuse your life with action. Don't wait for it to happen. Make it happen. Make your own future. Make your own hope. Make your own love. And whatever your beliefs, honor your creator, not by passively waiting for grace to come down from upon high, but by doing what you can to make grace happen... yourself, right now, right down here on Earth." }, { "text": "I think people who are creative are the luckiest people on earth. I know that there are no shortcuts, but you must keep your faith in something Greater than You, and keep doing what you love. Do what you love, and you will find the way to get it out to the world." }, { "text": "Where there is a will, there is a way. If there is a chance in a million that you can do something, anything, to keep what you want from ending, do it. Pry the door open or, if need be, wedge your foot in that door and keep it open." }] let selectedText; function displayText() { let selectedTextIndex = Math.floor((Math.random() * 3)); selectedText = textArray[selectedTextIndex].text document.getElementById("content-text").innerHTML = selectedText; } function calculateWordCount() { let searchText = document.searchForm.searchText.value; console.log("Text is: ",selectedText) console.log("Search text is: ",searchText) let wordCount = 0; //code goes here document.getElementById("output-text").innerHTML = "Word count is: " + letter_Count; } this is the actual code they gave it to me. I need to update code to get the correct output