Please don't forget that Joplin is not a text editor - or at least it is not its main purpose.
Also, even if there was code folding, it would not be persistent, so how useful is it really? Anyway, Caleb is right. This might be done via plugin at one point.