Suppose that we need to get folder (SP.Folder) where specific list item (SP.ListItem) is located. The following code shows how to do that:
Here at first we load file (SP.File) (lines 2-3), then get relative url (lines 6-7) and by this relative url get folder (lines 8-9). JSOM documentation says that there is SP.ListItem.folder property available, but it always returned error for some reason. May be it will be fixed in future updates.