Hello world!
class SoftwareEngineer {
readonly name = 'Dmitriy'
readonly lastName = 'Lomov'
readonly birthdate = '12.07.1990'
private technologies = {
languages: [
'JavaScript',
'TypeScript'
],
frontend: [
'ReactJS',
"NextJS",
"GraphQL",
'Redux',
'RTK',
'RTK Query',
'MobX',
'FSD',
'Sass'
],
backend: [
'NodeJS',
'Express',
'NextJS'
],
mobile: [
'React Native',
'Expo'
],
UILibrary: [
'MUI',
'AntDesign',
'NativeBase',
'Mantine'
],
dataBase: [
'PostgreSQL',
'MongoDB'
],
other: [
'git',
'Docker',
'Webpack',
'Vite',
'Figma'
]
}
private calculateAge() {
const day = parseInt(this.birthdate.substring(0, 2));
const month = parseInt(this.birthdate.substring(3, 5));
const year = parseInt(this.birthdate.substring(6, 10));
const today = new Date();
const birthDate = new Date(year, month - 1, day);
const m = today.getMonth() - birthDate.getMonth();
let age = today.getFullYear() - birthDate.getFullYear();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
}
get fullName() {
return `${this.lastName} ${this.name}`
}
get age() {
return this.calculateAge()
}
public greetStranger() {
return `
Hello! My name is ${this.fullName}. I am ${this.age} years old. Glad to see you on my page.
That's what I can: ${JSON.stringify(this.technologies, null, 4)}
`
}
}
const I = new SoftwareEngineer()
I.greetStranger()