simple string manipulation using javascript