Reverse a number in javascript
<p>I want to reverse a number t following the tutorial.First I have passed a number as a parameter. I have converted the number to string with to String function. Then I used split("").reverse().join("") to reverse the number.
My code is as follows:</p>

<pre><code>&lt;script type="text/javascript"&gt;


        function reverse_the_string(num) {
            num = String(num);
            // str = num.toString;
            num.split("").reverse().join("");
            return;
        }
        console.log(reverse_the_string(56789));
    &lt;/script&gt;
</code></pre>

<p>However I get an error undefined? Can anyone explain what is the wrong?</p>