Because of the `declarations.splice(i++...`. forEach bring issue when you modify the array during the loop. (duplicate resolved value)