I just started to study Javascript and I am struggling to solve if and else if usage. here is my code. The problem is it kept showing 'none' results at the end no matter what numbers are put. Can you explain it to me?
<script type="text/javascript">
var grades,scores;
scores=prompt ('write your score to convert it to grades');
if (scores>101)
grades='high distinction';
else if (scores>91)
grades='distinction';
else if (scores>81)
grades='credit';
else if (scores>71)
grades='pass';
else if (scores>61)
grades='fail';
else (scores<60)
grades='none';
document.write ('your grade name is'+grades);
</script>
Aucun commentaire:
Enregistrer un commentaire