Duck Punching in JavaScript (with Example)

Ekansh Kothiyal
Jun 16, 2020 · 3 min read
Photo by Aleks Marinkovic on Unsplash

We have the famous Duck Test:

If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck!

Coasting off that, we have Duck Punching (or Monkey Patching) in programming — a technique wherein alterations are made to a dynamic code during runtime without altering the source code.