The Islanders have learned to never count themselves out of a game.

Their 5-3 win Thursday night over the Kings at Barclays Center was the third-straight game in which the Islanders had to claw out of a hole. The first, against the Canucks, resulted in an overtime loss, but the Islanders put on impressive displays of resiliency to pull out come-from-behind victories in their past two games.

“It’s easy to be a front-runner, it’s harder to come back in this league,” coach Barry Trotz said. “It happens to everybody, teams will come back on you. … It’s hard to sustain a lead and all that. But obviously when you score the first goal, the other team needs two. And when the other team scores two, you need three just to win.”

Trailing 3-1 in the second period, the Islanders stuck with it until rookie Kieffer Bellows made it a one-goal game at 10:22 with the first goal of his NHL career. Maybe it was because a 21-year-old, in his second career game, was putting up the strongest fight, but the Islanders rallied with goals from Matt Martin, Bellows again and Anders Lee (an empty-netter).

Martin struck just 23 seconds into the third to give the Isles ample time to secure the win.

“Certainly builds confidence,” Martin said. “Anytime you’re down in a game and things aren’t going well, it just feels like a real uphill climb. And when you string games together where you’re able to battle back, you never feel like you’re out of it and you feel like you can come back and win. We believe we can do that and it’s shown over the last three.

“Obviously, we like to play with leads, but our resiliency has been really strong. Just got to keep finding ways.”

Defenseman Devon Toews played in his 100th NHL game.

Toews, who was drafted in the fourth round in 2014, made his debut in December of last season and has appeared in every game since. He is the eighth defenseman from the 2014 draft class to reach the 100-game milestone and the second defenseman taken after the second round to do so.

“One hundred games is a lot of games,” Toews said. “But hopefully there’s a lot more in the future.”

Riding a three-game point streak, defenseman Ryan Pulock got his 100th career point with an assist on Martin’s game-tying goal.