Question: I want to say first. Very beginner. Be kind. However. I am attempting to reverse a string. Put a string into a function as an argument and reverse its order. For example 'hello' should return 'olleh', etc.

I have complete this by doing:

```
function revString(stringArg) {
    return stringArg.split("").reverse().join(");
}

```

However. By doing it like this:

```
function revString (stringArg) {
    stringArg.split("");
    stringArg.reverse();
    stringArg.join("");
    return stringArg;
}

```

The resulting output for the second function is that reverse() is not a function. Can someone tell me what the difference here is?

Answer: 
This happens because `split()` does not split the string *in place*, but instead returns the split string as a new value. In your second function, you do `stringArg.split()`, but since that operation doesn't happen in place, `stringArg` is never mutated. It retains the exact same value and type throughout, which leads to the error you're seeing.

The reason the first function works is because the function calls are applied to the return value of the previous call. In other words:

* `split()` is called on `stringArg`
* `reverse()` is called on the *returned value* of `split()`, which is an array and therefore can be directly reversed
* `join()` is called on the *returned value* of `reverse()`

But in the second function you're calling them all on the exact same variable, `stringArg`, which stays the same throughout. In order for your function to work you need to modify it like so:

```
function revString (stringArg) {
    a = stringArg.split(""); // Array
    b = a.reverse(); // Reversed array
    c = b.join(""); // String
    return c;
}

```

However this, while easier to understand perhaps, is needlessly verbose. I recommend sticking with the original function.
The first example chains the results of previous method call, where `.split()` returns an array as first link in chain. 

The second example performs a separate task on the original string at each line, not chained to the first line which returns an array. 

`.reverse()` is not a method defined at `String.prototype`, resulting in the error at `stringArg.reverse()` at second line of function call.