0

i'm just a newbie on javascript , please help me this

var arr = [{"student-name":"Harry Potter","discipline":"Magic"}] ;

how can i get "Harry Potter" in this array , thanks for helping

  • 2
    `arr[0]["student-name"]`. If you made this Array yourself, consider following standard naming conventions: `const array = [ { studentName: "Harry Potter", discipline: "Magic" } ]; console.log(array[0].studentName);`. – Sebastian Simon Dec 21 '22 at 09:47
  • This is one of my test in school , so i can't change "student-name" into "studentName" , thank u so much for helping me . – KIEN_REA_030204 Dec 21 '22 at 09:59

0 Answers0