how to reverse a string in javascript using inbuilt functions