My point earlier was that the child not yet old enough to understand that is also not going to be able to comprehend why it's suddenly being attacked.
Not so...children aren't dogs. They are smarter.
Even a one year old understands simple correlations and strong tones in our voices.
For instance, a one year old reaches for an electrical chord. You smack their hand and yell "NO!!"..point at the object...smack again, and again shout NO! Often the one year old will immediately reach for it again - but you will notice they are staring at you seeing what your response is, and slowly reaching. They are not rebelling, they are seeing if your shouting and smacking has to do with that object - and thus - another smack and yell teaches them that it does.
It is very effective at that very young age.
I raised two children as well as I have seven nieces and nephews.