Both teams flipped the script and that is what it takes to make it to the NLCS.

The Cardinals and Nationals changed the culture in their respective clubhouses. As a result, when they needed each other most as teammates, each club was able to come through, and now they square off Friday night in Game 1 of the NLCS at Busch Stadium as St. Louis once again becomes the centerpiece of the National League.

Miles Mikolas will be the Game 1 starter for the Cards, while Anibal Sanchez will go for the Nats.

Paul Goldschmidt was a huge addition to the Cardinals. The Nats became Anthony Rendon’s team when they let Bryce Harper walk away as a free agent to the Phillies, who fired their manager Gabe Kapler on Thursday.

Both teams won Game 5 on the road in the NLDS.

The Cardinals crushed the Braves, 13-1, at SunTrust Park. The Nats won their first postseason series ever, shocking the more talented Dodgers, 7-3, at Dodger Stadium in 10 innings on the strength of Howie Kendrick’s grand slam. There were huge eighth-inning home runs from Rendon and Juan Soto that tied the score against Dodgers legend Clayton Kershaw.

Both teams put together amazing comebacks to get to this point. The Nats started the season 19-31. They scored three runs in the eighth inning to beat the Brewers, 4-3 in the wild-card game.

The Cardinals wisely made the huge trade for Goldschmidt, spending big money, after missing the postseason three straight years, while the Nationals elected to let Harper walk away.

“Changed the culture of the team,’’ one Nationals official told The Post recently.

Remember that seven-run comeback against the Mets the Nats produced in early September? That comeback told you about their new-found determination.

Rendon hit .412 against the Dodgers with a 1.219 OPS and that big home run. Goldschmidt batted .429 against the Braves with a 1.383 OPS and two home runs.

Superstars getting it done in October.

After a comeback win in Game 4, in Game 5 the Cardinals left no doubt with a 10-run first inning against Atlanta, silencing the Braves’ chop chant.

In spring training, Adam Wainwright told me the Cardinals would be back in a big way this year as he pointed over to Goldschmidt’s locker, noting, “This is a very complete team. You look at the lineup, the bullpen, the rotation: There’s really not many holes on this team, and not many teams can say that. We should be able to compete at a very, very high level. I like our chances.’’

After beating the Dodgers, Goldschmidt said the Cardinals Way is real. The team expects great things and this is the first step.

“That’s what this organization’s all about,’’ the first baseman said. “The tradition has been set by the guys way before me. That’s what the fans expect. Ownership, front office, players and coaches. That’s awesome. That’s what you want. That’s what we want to do. It’s just taking it step-by-step.”

Step-by-step, setting up what should be a thrilling NLCS.

St. Louis play with a chip on its shoulder — that is the Cardinal Way, too, and that was obvious to the world when manager Mike Shildt offered his postgame speech that was streamed by young Cardinals outfielder Randy Arozarena, giving an inside look that Shildt doesn’t give a s–t about what the world things of his team.

“They started some s–t” he said of the Braves. “We finished the s–t. And that’s how we roll. No one f—- with us. Ever. Now, I don’t give a f— who we play. We’re going to f— them up.’’

Shildt apologized for his language Thursday.

The Cardinals did not like Ronald Acuna Jr.’s approach in the series and ace Jack Flaherty hit Acuna in the shoulder with a fastball in Game 5. The Cardinals play hardball.

Former Yankee and current Cardinals reliever Andrew Miller noted Thursday what baseball is like in St. Louis.

“You can turn yourself into a legend in a place like this,’’ he said. “I think it’s neat, it’s the stage we all want to get to and perform well on.’’

The NLCS stage is lit.