updated script.js

Added some of the comments to explain the program.

Fixed the output if statement so correct output is displayed based on
grade letter.

Removed the need for an array index variable by using the array length
as the counter.