Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Answer: 43 #1149

Conversation

michalgrzegorczyk-dev
Copy link
Contributor

Checklist for challenge submission

  • Start your PR message with Answer:43

Warning:

  • If you want feedback or review, you must support the project on GitHub:

Alternatively, you can still submit your PR to join the list of answered challenges or to be reviewed by a community member. 🔥

@github-actions github-actions bot added 43 signal inputs answer answer sponsor sponsor the project to be reviewed PR requests a review labels Nov 15, 2024
export class UserComponent {
readonly name = input.required<string>();
readonly lastName = input<string>('');
readonly age = input<string>('');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add a transform method to make it a number with a default value to 0

this.fullName = `${this.name} ${this.lastName ?? ''}`;
this.category = ageToCategory(Number(this.age) ?? 0);
}
readonly fullName = computed(() => `${this.name()} ${this.lastName() ?? ''}`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need the ?? '', lastName has a default value.

10: 'Youth',
18: 'Junior',
35: 'Open',
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not putting this const outside of the scope of the function, so you don't recreate it at each call.

@tomalaforge
Copy link
Owner

nice work

@tomalaforge tomalaforge removed the to be reviewed PR requests a review label Nov 17, 2024
Copy link

github-actions bot commented Dec 8, 2024

This pull request is stale because it has been open for 15 days with no activity.

@github-actions github-actions bot added the stale label Dec 8, 2024
Copy link

This pull request was closed because it has been inactive for 5 days since being marked as stale.

@github-actions github-actions bot closed this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
43 signal inputs answer answer sponsor sponsor the project stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants