CN Name in xpages

How can i do this formula in xpages javascript? I am having trouble adjusting from formula language to xpages. Any learning resources would be useful.

@name([cn];@username)

Subject: This syntax should do it

Hi Nathan,

try: @Name(“[CN]”, @UserName());

You can also use the Notes classes:

var name:NotesName = session.createName(@UserName());

name.getAbbreviated();

-John