How to increment a value in a JavaScript object? December 19, 2023 by Tarik Here you go minimize your code. map[key] = (map[key]+1) || 1 ;