General considerations
Publishing papers in different journals diversifies your research profile. Diversifying your research is a good strategy for 1) showcasing your research, 2) increasing your employability, and 3) highlighting your breadth of knowledge and expertise. Therefore, publishing in many different journals, including those outside your field of expertise, is generally a positive step. However, there is a trade-off between the quality and quantity of your research. Having lots of papers of low quality research in lower-tier journals may reflect more poorly than having fewer papers that are high quality in higher impact journals. This trade-off is sensitive to your current stage in your career (early career researcher versus tenured professor), but, ideally, the more higher quality papers you have, the better your chances of future employment. Elsevier, a major publishing company, has a comprehensive guide that provides useful and detailed information on publishing research papers: https://www.elsevier.com/__data/assets/pdf_file/0003/91173/Brochure_UPP_April2015.pdf.
Practical example for Life Sciences
Within the life sciences, diversifying your research across different journals is a common strategy for enhancing your research acumen. There is a trade-off between the type of paper you publish, i.e. research, review, or technical, and the quality and quantity of research papers you publish throughout your career. Publishing a lot of papers is the best approach, but ensuring these are all high impact papers is difficult. Therefore, as an author, you will need to find a suitable balance between publishing fewer, high impact papers and many, less impactful ones. A mixture of both is most attainable and thus most common among academics in the life sciences. However, the aim is to always publish more high impact papers. Publishing in many, top-tier journals will boost your research profile, employability, and professional status.
Practical example for Social Sciences
In social sciences, the focus is primarily on quality over quantity. While it can certainly boost your CV to have a large number of publications, a competing candidate with fewer publications in higher-ranked journals will most often be considered to be the preferable candidate. That being said, it is important that you demonstrate your ability to publish across a spectrum of journals is advisable.
Further useful reading: