Cookies help us deliver our Services. By using our Services, you agree to our use of cookies. Learn More.

The HIMYM Episode You Likely Forgot Starred Jennifer Lopez

"How I Met Your Mother" boasted a number of exciting guest stars during its nine-season run. Celebrities of all stripes made appearances on the series, sometimes playing up their own public image, but often lending their talents to other characters. "The Price is Right" host Bob Barker and Maury Povich of "Maury" are just a few of the celebs who appeared as themselves. Meanwhile, actors like Lucy Hale had juicy guest-starring roles as characters integral to the "How I Met Your Mother" world. And one of the most notable kinds of celebrities to appear on the series were musicians. 

Pop sensations Katy Perry and Britney Spears appeared on the show as would-be lovers of Barney Stinson (Neil Patrick Harris), while "American Idol" winner Carrie Underwood played a love interest stringing Ted (Josh Radnor) along. Robin Scherbatsky (Cobie Smulders) even got the opportunity to romance Enrique Iglesias, who popped up for a two-episode arc as a would-be Argentinian lover. One of Iglesias' collaborators both on the stage and in the recording booth, Jennifer Lopez, also guest-starred on the hit CBS series. Here is who she played.

Jennifer Lopez played an author who challenged Barney

Pop music sensation and actor Jennifer Lopez appeared as Anita in the "How I Met Your Mother" Season 5 episode "Of Course." Anita is the author of a self-help book that aims to empower women to reject self-satisfying men. In an attempt to teach her ex a lesson, Robin asks Anita to break the willpower of the womanizing Barney. As the episode goes on, however, the tables turn, and it's Barney who ends up rejecting the confident Anita.

"Of Course" was well-received upon its release in 2010, with IGN giving the episode a near-perfect score for challenging Barney and expanding Robin's character and emotional circumstances. During a behind-the-scenes interview, Lopez praised the show's writing and called stepping into the role of Anita both easy and fun. "Believe it or not, I don't get to play 'sexy' a lot in my movies. I do romantic comedies and dramas and it's not that type of thing," Lopez said. "I haven't really done that 'femme fatale' role, so it's fun to get to do it here."

One can only hope that Anita returns to guide Hilary Duff's character Sophie in Season 2 of the spin-off "How I Met Your Father."