Question regarding read the code

Can someone explain to me the the last part of the code means the else statement? . Thant will be helpful thanks.

if( modalWindow.classList ){ //read that it has a class
     modalWindow.classList.add('open') //adds the class name open
 }else{
     modalWindow.className += ' ' + 'open';  // ?  <------  +=  ' ' + 'open '
 }

Basically, there’s a DOM Api for adding, removing, renaming, a class in CSS via JavaScript.

ClassName += open means whatever css class this modal Window has, add space + ‘open’ to it

Example:

var number = 1;

number += 3;
// equal to number = number +3

//4

This is the reference for it https://developer.mozilla.org/en-US/docs/Web/API/Element/className

Thank you for the feedback but it dosent make sense to add a space and the string open for ? I mean its opening the modal, class.

Thank you tho for the information i will take a look at it.

Yes. It must’ve been a bug. It could be modal.classList.remove('open')

Yes, i believe so as well, i do think that dosent make any sense at all…
Thanks for the quick reply, and for the all the help… many thanks.