Thursday was a tale of two markets. The Dow Jones Industrial Average (^DJI -0.21%) stayed strong, but the Nasdaq Composite (^IXIC -0.56%) fell sharply. Financial reports in the tech arena have been extremely challenging for shareholders, but many companies in areas like industrials and consumer staples have performed more strongly during earnings season.

Index

Daily Percentage Change

Daily Point Change

Dow

+0.61%

+194

S&P 500

(0.61%)

(23)

Nasdaq

(1.63%)

(178)

Data source: Yahoo! Finance.

In the middle of a bear market, it's easy to forget that some stocks aren't struggling as much as others. Indeed, there are still some companies whose shares are setting new all-time highs. Today, you'll learn more about Hershey (HSY -0.75%) and AutoZone (AZO 1.54%), and why shareholders in these companies have been celebrating lately.

Hershey looks like a sweet stock

Shares of Hershey climbed almost 1% on Thursday. Gains earlier in the day sent the stock to record levels, up about 150% since 2018.

In an inflationary environment, a consumer stock needs to have pricing power, and that's something that Hershey's strong brand awareness gives the company. In the second quarter, Hershey grew its revenue by 19%, partially through organic sales gains and to some extent from acquisitions in both the sweet and salty areas of the snack industry. With an extremely efficient distribution network already in place, the new brands that Hershey has acquired have risen in value simply by being associated with the chocolate giant.

Investors also like stocks that pay healthy dividends, and Hershey has done a good job on that front. The company's 1.8% yield isn't the highest in the market by far, but a steady track record of consistent dividend increases has rewarded shareholders over time. Hershey's most recent 15% jump took the quarterly payout to $1.036 per share.

Looking ahead, Hershey is set to reveal its third-quarter results next week. If it can keep up its impressive record of performance, then more all-time highs could lie ahead for the food stock .

AutoZone revs up

Shares of AutoZone also reached new heights, picking up more than 4% on Thursday. That took the stock above the $2,500 mark, but the auto parts retailer has the fundamental strength to justify a high share price.

AutoZone has benefited from a number of trends favoring its business. Given the high price of used cars, it's far easier for drivers to try to do repairs themselves in order to hold onto their vehicles longer than it is to find a replacement vehicle. Given persistent supply chain issues, moreover, even new vehicle purchases are a challenge, pushing more business to AutoZone's stores.

To be fair, AutoZone has to deal with many of the same difficulties that both its peers in the auto parts arena and the broader retail industry have faced. Finding qualified labor has been difficult, and supply chain challenges do mean that the company sometimes has trouble getting the parts that its customers want as quickly as it would like.

Moreover, some fear that electric vehicles could be a trend against AutoZone. They tend to have fewer parts that owners can replace themselves, potentially hurting the retailer's appeal with do-it-yourselfers.

Investors won't get another read from AutoZone until early December, but today's gains seem to stem from a belief that the economy could prove to be more resilient than some believe. If that proves to be the case, then AutoZone could have even further to climb from here.