J/$\psi$ production is sensitive to the deconfined strongly interacting medium produced in ultrarelativistic nuclear collisions. Measurement of prompt and non-prompt J/$\psi$, the latter originating from beauty hadron decays, are essential to investigate the parton energy loss in the hot medium and its quark mass dependence. In addition, the production of prompt J/$\psi$ provides a direct comparison with models that include regeneration, which is the dominant production mechanism at low transverse momentum ($p_{\rm T}$) in central collisions at the LHC.
In this contribution, recent ALICE results on prompt and non-prompt J/$\psi$ nuclear modification factors ($R_{\rm AA}$), as a function of $p_{\rm T}$ and in several centrality ranges, are discussed. Presented results, obtained by using the full available statistics from Pb$-$Pb collisions collected at $\sqrt{s_{\rm NN}}$ = 5.02 TeV during the LHC Run 2, are compared with similar measurements from CMS and ATLAS experiments and to theoretical predictions.