Line 3-4 could be replaced with: 

    sessionStorage?['closedAnnouncement'] = ($ '.alert-announcement').html()

(notice the `?`)