epay interview question

Whats the difference between map and foreach in javascript