Question: Why is my `function` returning undefined along with the reversed string

```
function revString(str)
{
    var a,c;
    a=str.length-1;

    while(a>=0)
    {
       c = c + str[a];
       a--; 
    }
  return c;
}
console.log(revString("Google"));

```

I am not sure on where it is breaking. I know there are lots of answers to the same question, but i just want to understand the mistake happening here.

Below is the fiddle
<http://jsfiddle.net/c94fq78v/2/>

Answer: 
When you start the loop `c` is `undefined`. You need to initialize it to the empty string.

What happens is that adding `undefined` to the first character converts `undefined` to the string `"undefined"`.
You need to initialize `c` variable