[COLOR=#000000][FONT=Arial]I am taking a class which requires me to code using javascript. The assignment that I’m working on is not working and I know that this assignment was previously posted. The problem is, I still couldn’t get the file to work properly. What am I doing wrong?[/FONT]
[COLOR=#000000][FONT=Arial]This is my code:[/FONT]
[COLOR=#800000]<script[COLOR=#FF0000]language[COLOR=#0000FF]“javascript”[COLOR=#800000]>[COLOR=#00008B]function[COLOR=gray]// Add your code here to count the coins and display your answers[COLOR=#00008B]var[COLOR=#800000]“coinJar”[COLOR=#800000]0[COLOR=gray]//first get the value[COLOR=#00008B]var[COLOR=#800000]“,”[COLOR=gray]//split it[COLOR=#00008B]var[COLOR=#00008B]new[COLOR=#2B91AF]Array[/COLOR[COLOR=#00008B]var[COLOR=#800000]0[COLOR=#800000]0.01[COLOR=#800000]0.05[COLOR=#800000]0.10[COLOR=#800000]0.25[COLOR=#800000]0.50[COLOR=gray]//coin values[COLOR=#00008B]var[COLOR=#800000]‘pennies’[COLOR=#800000]‘nickels’[COLOR=#800000]‘dimes’[COLOR=#800000]‘quarters’[COLOR=#800000]‘halfdollars’[COLOR=gray]//ids of coins*[COLOR=#00008B]var[COLOR=#800000]0[COLOR=gray]//total dollar amount[COLOR=#00008B]var[COLOR=#800000]0[COLOR=gray]//amount of coins.[COLOR=#00008B]var[COLOR=#800000]5[COLOR=#800000]0[COLOR=#800000]0[COLOR=#800000]1[COLOR=#800000]1[COLOR=#800000]1[COLOR=#800000]1[COLOR=#800000]2[COLOR=#800000]2[COLOR=#800000]1[COLOR=#800000]3[COLOR=#800000]3[COLOR=#800000]1[COLOR=#800000]4[COLOR=#800000]4[COLOR=#800000]1[COLOR=#00008B]var[COLOR=#800000]0[COLOR=#800000]01[COLOR=#800000]1*.[COLOR=#800000]05[COLOR=#800000]2[COLOR=#800000]10[COLOR=#800000]3*.[COLOR=#800000]25[COLOR=#800000]4[COLOR=#800000]50[COLOR=#00008B]var[COLOR=#800000]0[COLOR=#800000]1[COLOR=#800000]2[COLOR=#800000]3[COLOR=#800000]4[COLOR=gray]/*for (var i = 0; i < coinArray.length; i++) { var currentvalue = parseInt(coinArray[i]); //value of current coin document.getElementsByName(ids[i])[0].innerHTML = currentvalue; //set the html total += currentvalue [i]; coinnumber += currentvalue; for ( i = 1; i < coinArray.length; i++) { currentvalue = parseInt(coinArray[i]); //value of current coin document.getElementsByName(ids[i])[1].innerHTML = currentvalue; //set the html total += currentvalue * values[i]; coinnumber += currentvalue; } for ( i = 2; i < coinArray.length; i++) { currentvalue = parseInt(coinArray[i]); //value of current coin document.getElementsByName(ids[i])[2].innerHTML = currentvalue; //set the html total += currentvalue [i]; coinnumber += currentvalue; } for ( i = 3; i < coinArray.length; i++) { currentvalue = parseInt(coinArray[i]); //value of current coin document.getElementsByName(ids[i])[3].innerHTML = currentvalue; //set the html total += currentvalue * values[i]; coinnumber += currentvalue; } for ( i = 4; i < coinArray.length; i++) { currentvalue = parseInt(coinArray[i]); //value of current coin document.getElementsByName(ids[i])[4].innerHTML = currentvalue; //set the html total += currentvalue [COLOR=#800000]‘totalValue’[COLOR=#800000]0[COLOR=#800000]‘totalCoins’[COLOR=#800000]0[COLOR=gray]//document.getElementsByName(‘totalValue’)[1].innerHTML = total;[COLOR=gray]//document.getElementsByName(‘totalCoins’)[1].innerHTML = coinnumber;[COLOR=#800000]</script>[COLOR=#000000][FONT=Arial]It needs to get values for how many coins there are in each denomination from a penny to a half dollar. Then it needs to give a value for all of the coins.[/FONT]