I have a 2D array containing student profiles. Where Column 1 contains First Name, Col2 contains Middle Name, Col3 Last Name and so forth.
What I'm hoping to do is joining text from all three column, convert to upper case, then place back onto Column 1 i.e "FIRSTMIDDLELAST" in cell A1.
My snippet of code is below seems straight forward enough but I'm only very new to JS, upon executing I get an error..
Cannot read property "0" from undefined.
@ line
StudentList[i][0].concat(FistName,MidlName,LastName);
for (var i=0; i<StudentList.length; i++){
var FistName = StudentList[i][0].valueOf().toUpperCase();
var MidlName = StudentList[i][0].valueOf().toUpperCase();
var LastName = StudentList[i][0].valueOf().toUpperCase();
StudentList[i][0].concat(FistName,MidlName,LastName);
}
Some help would be greatly appreciated. Thank you so much advance.
UPDATE:
This is a small sample of the Google Spreadsheet where I my array came from ....
First Middle Last Age Grade English Maths
John Peter Smith 17 12 A A
Kevin Paul James 16 11 B C
Kim Caroline Anderson 15 10 B A
.... so on
debugger;beforevar FistName = StudentList[i][0].valueOf().toUpperCase();, open your DevTools and check using the console. while the breakpoint is stopped... also seems you're taking the same column for all three names... your should change yourStudentList[i][0]forStudentList[i][1]and[2].valueOf()call?