Fixed Javascript by adding JSON.stringify

Fixed Javascript to support passing permissions from getPermissions
function to copyPermissions function
Updated readme.md.
Removed commented code.