0

I can't get my Array to print. Can anyone help me?

<!DOCTYPE html> <html> <head> <title>Project JS Array</title> <meta charset="utf-8" /> <!-- prjJSArray.html - my code for Project JS Array Thomas E. Weber - thomas.weber@my.southcentral.edu Written:10/21/2016 --> <script> var years = new Array() var ranks = new Array() var paychecks = new Array() years[0] = "Grade/Years "; years[1] = "2 or less "; years[2] = "Over 2 "; years[3] = "Over 3 "; years[4] = "Over 4 "; years[5] = "Over 6 "; //row 1 paychecks[0][0] = "E1"; paychecks[0][1] = "$1566.90"; paychecks[0][2] = "Promotion needed."; paychecks[0][3] = "Promotion needed."; paychecks[0][4] = "Promotion needed."; paychecks[0][5] = "Promotion needed."; //row 2 paychecks[1][0] = "E2"; paychecks[1][1] = "$1756.50"; paychecks[1][2] = "$1756.50"; paychecks[1][3] = "$1756.50"; paychecks[1][4] = "$1756.50"; paychecks[1][5] = "$1756.50"; //row 3 paychecks[2][0] = "E3"; paychecks[2][1] = "$1847.10"; paychecks[2][2] = "$1963.20"; paychecks[2][3] = "$2082.00"; paychecks[2][4] = "$2082.00"; paychecks[2][5] = "$2082.00"; //row 4 paychecks[3][0] = "E4" paychecks[3][1] = "$2046.00"; paychecks[3][2] = "$2150.40"; paychecks[3][3] = "$2267.10"; paychecks[3][4] = "$2382.00"; paychecks[3][5] = "$2483.40"; //row 5 paychecks[4][0] = "E5"; paychecks[4][1] = "$2231.40"; paychecks[4][2] = "$2381.40"; paychecks[4][3] = "$2496.60"; paychecks[4][4] = "$2614.20"; paychecks[4][5] = "$2797.80"; function displayArray(thisArray, thatArray) { document.write

29th Oct 2016, 12:08 AM
Thomas Weber
Thomas Weber - avatar
1 Resposta
0
Doesn't look like your code is complete in the example given. Try: document.write(arrayName); // Should print the entire array where as document.write(arrayName[arrayIndex]); // Would print what ever value is at the specified index. Hope that helped a little
31st Oct 2016, 3:06 PM
Pink Lemonade