Files
wehub-resource-sync c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:02:24 +08:00

71 lines
1.8 KiB
Plaintext

// Class definition for a Person
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
// Method to return a greeting message
greet() {
return `Hello, my name is ${this.name} and I'm ${this.age} years old.`;
}
// Method to celebrate birthday
celebrateBirthday() {
this.age += 1;
return `Happy Birthday, ${this.name}! You are now ${this.age} years old.`;
}
}
// Class definition for a Student, extending from Person
class Student extends Person {
constructor(name, age, grade) {
super(name, age);
this.grade = grade;
}
// Method to describe the student
describe() {
return `${this.name} is a ${this.grade} grade student and is ${this.age} years old.`;
}
}
// Function to enroll a new student
function enrollStudent(name, age, grade) {
const student = new Student(name, age, grade);
console.log(student.greet());
console.log(student.describe());
return student;
}
// Function to promote a student to the next grade
function promoteStudent(student) {
student.grade += 1;
console.log(`${student.name} has been promoted to grade ${student.grade}.`);
return student;
}
// Variable definition and assignment
let schoolName = "Greenwood High School";
let students = [];
// Enrolling students
students.push(enrollStudent("Alice", 14, 9));
students.push(enrollStudent("Bob", 15, 10));
// Looping through students to celebrate their birthdays
students.forEach(student => {
console.log(student.celebrateBirthday());
});
// Promoting all students
students = students.map(promoteStudent);
// Displaying the final state of all students
console.log("Final Students List:");
students.forEach(student => console.log(student.describe()));
// Updating the school name
schoolName = "Greenwood International School";
console.log(`School Name Updated to: ${schoolName}`);