7 Submit yourselves therefore to God. Resist the devil, and he will flee from you.
8 Draw near to God, and he will draw near to you. Cleanse your hands, you sinners, and purify your hearts, you double-minded.
9 Be wretched and mourn and weep. Let your laughter be turned to mourning and your joy to gloom.
10 Humble yourselves before the Lord, and he will exalt you.
James warns the readers that they need to cleanse their hands and purify their hearts and reference their double-mindness. Verse 9 has always confused me, but the ESV Study Bible gives this explanation:
Cleanse and purify are OT terms for ritual purity and ethical purity. Laughter shows how casually James's readers were treating their sin. The only proper reaction to God's impending judgement is to be wretched and mourn and weep, as seen often in the OT.
Looking at the full context of the chapter James is reminding us of the importance of taking our sin serious.