I have the following code:
const calendarHeading = (month, year) =>{
let monthH3 = document.createElement('h3')
monthH3.classList.add('calendar__heading-month')
monthH3.innerHTML = monthObjects[month].month
let yearSpan = document.createElement('span')
yearSpan.classList.add('calendar__heading-year')
yearSpan.innerHTML = year
let targetDiv = document.querySelector('.calendar__heading')
targetDiv.appendChild(monthH3)
document.querySelector('.calendar__heading-month').appendChild(yearSpan)
};
Pretty much I am creating an H3 element and a Span element.
I then attach the h3 element to the already created div in the html.
I then attach the span to the newly created h3 node.
My question is, is there a way to do this in one line? Or am I overthinking things, I am noob i am sorry :(