Intercom interview question

A javascript code with some errors to fix