JavaScript - 10

JavaScript - 10: Objects

Create an object called student with properties: name, age, grade, and subjects (an array). Then use console.log() to print some information about the student.

✦ JavaScript Editor
▶ Live Output

👀 Show Solution
let student = {
  name: "Liam",
  age: 17,
  grade: "A",
  subjects: ["Math", "Physics", "English", "History"]
};

console.log(student.name + " has grade: " + student.grade);
console.log("Number of subjects: " + student.subjects.length);
console.log("Subjects:", student.subjects);