added/fixed doc js sample code.