Jehoiada lived after the accession of Joash at least 23 years 2 Kings 12:6. Thus the idolatries of Joash 2 Chronicles 24:18 were confined to his last 10 or 15 years.
Related Commentaries of 2 Chronicles 24:2
2 Chronicles 24:2
2 And Joash did that which was right in the sight of the LORD all the days of Jehoiada the priest.