fixed small accolade and bracket issue. Also an array has method forEach, not foreach