Return a string based on pulled dom elements
I have an object storing months and their index (not dates) monthList = {"jan" : "1", "feb" : "2". etc: etc}
The user can type something like jan or jan,feb,march and I want a string returned as 1 or 1,2,3 (which I use for a get call elsewhere) but haven't been able to do this, ive tried using all sorts of crazy loops to no avail, from incorrect reading to always reading last index, if the user inputs 1,2,3 that should also work.
The input values as simply called using ${document.getElementById('monthInput').value}
User Input Example #1: jan,feb,dec
User Input Output #1: 1,2,12
User Input Example #2: 1,2,5
User Input Output #2: 1,2,5
How can I do this?