Somebody please explain me this code in detail
function reverse(s){
return s.split("").reverse().join("");
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The function takes a string, it splits it in its constituent characters to obtain an array using the
splitfunction, it reverses this array using thereversemethod andjoins the elements with an empty string.Basically it reverses a string which given the name of the function I guess doesn’t come as a surprise to anyone.
So:
will return: