Your 40s are a great time to make significant contributions to your investment portfolio. With your career likely well established by now, this decade usually includes some particularly strong earnings years. In addition, retirement is still far enough away that there's plenty of time to allow a bullish investment thesis to develop fully.

With those serious investing benefits in mind, let's take a look at a few attractive stock ideas that might make good bets today.

Staying social

Many investors have been worried that Facebook's (NASDAQ:FB) growth rate would hit a wall, but the social media giant's latest earnings report instead showed signs of significant operating momentum. Its pool of monthly active users jumped 11% to 2.2 billion in the second quarter, with roughly two-thirds of those people logging in to the service at least once a day.

A father and daughter interact with a smartphone.

Image source: Getty Images.

Facebook had no trouble monetizing all of that engagement, either, as advertising sales spiked 42% to $13 billion.

Sure, the company's expansion pace is dropping from the 49% rate that shareholders enjoyed in fiscal 2017. It's also likely that profitability will decline as the company spends billions on bulking up its data infrastructure and rolling out service improvements. But there's no social media business that can come close to claiming the community engagement that Facebook has attracted, let alone its market-thumping earnings power. Thus, with its core business looking as healthy as ever, this stock could be poised for strong long-term gains.

Stick with the healthcare giant

Your 40s will likely contain higher spending on doctors' visits and pharmaceuticals than in prior decades of your life, and that's a nice reminder that healthcare is a massive, and profitable, business. An investment in Johnson & Johnson (NYSE:JNJ) can allow you to benefit from that fact even as you're spending more on those routine checkups.

Johnson & Johnson currently boasts a packed pipeline of over 40 late-stage drugs that have solid chances at becoming blockbusters over the next few years. These treatments are the result of nearly $9 billion of annual research & development spending, plus an aggressive acquisition program that helped push sales up by double-digits last quarter.

It's one of the largest companies around, so investors shouldn't expect that level of growth over the long term. However, in exchange for more modest sales gains, buying this stock delivers impressive diversification in the healthcare industry, and a rock-solid dividend to boot.

The robots are coming

As I mentioned above, there's no need to limit your investing options to conservative stock choices when you've got time on your side. That's why I think iRobot (NASDAQ:IRBT) could make a smart buy for long-term investors today.

A man reclines while a robotic vacuum cleans the floor.

Image source: Getty Images.

The robotic cleaning specialist's last report showed strong sales growth and steady profitability in the face of rising competition. That success implies the company might have big enough competitive advantages, including brand power and technical expertise, to hold on to a large portion of its current dominant market share as robotic cleaners move into the mainstream in the coming years.

To get to that prime positioning, iRobot will need to continue pushing the industry forward in its core vacuuming niche while expanding into complementary areas like mopping. Its next step along that road will depend on its newest innovations, which management hopes will help push annual sales to over $1 billion in 2018 after a strong holiday shopping season.

By the time investors in their 40s reach retirement age, that sales base could be far greater.

Demitrios Kalogeropoulos owns shares of Facebook. The Motley Fool owns shares of and recommends Facebook and iRobot. The Motley Fool owns shares of Johnson & Johnson and has the following options: short October 2018 $135 calls on Johnson & Johnson. The Motley Fool has a disclosure policy.