getCurrentUser javascript example

I am trying to use the getCurrentUser method with javascript and cannot get it working. I looked in the docks for an example at https://backendless.com/documentation/users/js/users_get_current_user.htm. But it looks to me like this example is not in javascript but java instead even though it is in the javascript docs. I also saw this forum post: http://support.backendless.com/t/only-backendless-user-accepted-backendless-min-js45#comment-2705 where it mentions method loggedInUser.

Can you please point me to somewhere in the doc that has a javascript example of getCurrentUser or similar method being used in a hosted script?

Thanks,
Greg

http://support.backendless.com/t/upload-image-uri#comment-3049

Hi GregMc,

How about this:

Backendless.UserService.login( userId, password );
var currentUserObjectId = Backendless.UserService. loggedInUser();
var currentUser = Backendless.Data.of( Backendless.User ).findById( currentUserObjectId );

Hope this helps.

Mark