Sort an array containing numbers using For loop
<p>I am new to Javascript, I have an array which contains numbers.</p>

<pre><code> var arr = [2,4,8,1,5,9,3,7,6];
</code></pre>

<p>How can i sort it using native For Loop in javascript.
I know sort function is available but i want it through for loop.</p>

<p>output should be- </p>

<pre><code> var res = [1,2,3,4,5,6,7,8,9];
</code></pre>