Reverse string without built-in function Javascript

To reverse a string in JavaScript without using built-in functions, you can use a loop to swap characters from the beginning and end of the string. Here’s an example:

Reverse string without builtin function

function reverseString(str)

{

    var reverse=”;

    for(i=str.length-1;i>=0;i–)

    {

    reverse+=str[i];

    }

    return reverse;

}

Output:

Reverse string without built-in function Javascript

Leave a Comment

Your email address will not be published. Required fields are marked *