mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-20 02:17:34 +00:00
lixi.json aktualisieren
This commit is contained in:
1 parent
624a89b18b
commit
7133c2a7fd
1 file changed
+1
-106
+1
-106
@@ -1,106 +1 @@
|
|||||||
/**
|
|
||||||
* Represents a person with information about their skills and project.
|
|
||||||
*/
|
|
||||||
class Person {
|
|
||||||
/**
|
|
||||||
* Constructor for the Person class.
|
|
||||||
*
|
|
||||||
* @param {string} name - The name of the person.
|
|
||||||
* @param {string} profession - The profession of the person.
|
|
||||||
* @param {string[]} skills - An array of skills the person has.
|
|
||||||
* @param {string} project - The project the person is working on.
|
|
||||||
*/
|
|
||||||
constructor(name, profession, skills, project) {
|
|
||||||
/** @private */
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
/** @private */
|
|
||||||
this.profession = profession;
|
|
||||||
|
|
||||||
/** @private */
|
|
||||||
this.skills = skills;
|
|
||||||
|
|
||||||
/** @private */
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter method to retrieve the name of the person.
|
|
||||||
*
|
|
||||||
* @returns {string} The name of the person.
|
|
||||||
*/
|
|
||||||
getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter method to retrieve the profession of the person.
|
|
||||||
*
|
|
||||||
* @returns {string} The profession of the person.
|
|
||||||
*/
|
|
||||||
getProfession() {
|
|
||||||
return this.profession;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter method to retrieve the skills of the person.
|
|
||||||
*
|
|
||||||
* @returns {string[]} The skills of the person.
|
|
||||||
*/
|
|
||||||
getSkills() {
|
|
||||||
return this.skills;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter method to retrieve the project of the person.
|
|
||||||
*
|
|
||||||
* @returns {string} The project of the person.
|
|
||||||
*/
|
|
||||||
getProject() {
|
|
||||||
return this.project;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates an interactive webpage with information about a person.
|
|
||||||
*
|
|
||||||
* @param {Person} person - The person object containing the information.
|
|
||||||
*/
|
|
||||||
function generateWebpage(person) {
|
|
||||||
// Create HTML elements
|
|
||||||
const container = document.createElement('div');
|
|
||||||
const nameElement = document.createElement('h1');
|
|
||||||
const professionElement = document.createElement('h2');
|
|
||||||
const skillsElement = document.createElement('ul');
|
|
||||||
const projectElement = document.createElement('p');
|
|
||||||
|
|
||||||
// Set content for HTML elements
|
|
||||||
nameElement.textContent = `Name: ${person.getName()}`;
|
|
||||||
professionElement.textContent = `Profession: ${person.getProfession()}`;
|
|
||||||
person.getSkills().forEach(skill => {
|
|
||||||
const skillItem = document.createElement('li');
|
|
||||||
skillItem.textContent = skill;
|
|
||||||
skillsElement.appendChild(skillItem);
|
|
||||||
});
|
|
||||||
projectElement.textContent = `Project: ${person.getProject()}`;
|
|
||||||
|
|
||||||
// Append elements to container
|
|
||||||
container.appendChild(nameElement);
|
|
||||||
container.appendChild(professionElement);
|
|
||||||
container.appendChild(skillsElement);
|
|
||||||
container.appendChild(projectElement);
|
|
||||||
|
|
||||||
// Append container to the body of the webpage
|
|
||||||
document.body.appendChild(container);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a person object
|
|
||||||
const person = new Person(
|
|
||||||
"Lixi",
|
|
||||||
"Dev",
|
|
||||||
["C#", "Python", "Java"],
|
|
||||||
"DevcoAI"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Generate the webpage with the person's information
|
|
||||||
generateWebpage(person);
|
|
||||||
Reference in new issue
Block a user