My js script is not working properly : <p>I want to have a result based on grading set by my script. But it's not giving me the result as expected. It's not doing anything in fact.    </p>

<p>Below is the code:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script&gt;
function rateMe()
{
var a = "";
var x = document.getElementById("id1").value;

if (x &lt; 10) {a = "Bad";}
if (x &lt; 50) {a = "Average";}
if (x &lt; 75) {a = "Good";}
if (x &lt; 100) {a = "Best";}

var y = document.getElementById("id2") + a;
}
y;
&lt;/script&gt;</code></pre>
</div>
</div>
</p>
