That’s how I have broken several puppies of the habit of gnawing on furniture legs—hiding out of sight and either tossing a beanbag to land right next to them, or squirting them with a water pistol. Works like a charm, and not just on naughty dogs. The evil spray of water coming down from the gods tends to discourage cats from scratching upholstery, too.
And (don’t judge me ) it’s also incredibly satisfying for me to occasionally make them think they’ve brought divine justice crashing down on their furry little butts!