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

add task solution #3795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add task solution #3795

wants to merge 1 commit into from

Conversation

Uusuff
Copy link

@Uusuff Uusuff commented Dec 28, 2024

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Your implementation of the convertToObject function is well done and meets the task requirements! 🎉 You've effectively used iteration methods like map and filter to transform the input string into a style object, and your approach aligns with the constraints provided. Keep up the great work, and continue honing your skills with these techniques! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

@@ -6,7 +6,21 @@
* @return {object}
*/
function convertToObject(sourceString) {
// write your code here
const filteredArray = sourceString

Choose a reason for hiding this comment

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

The initial split operation on the sourceString is correct, as it divides the string into an array of style declarations based on semicolons.

const styleObject = {};

for (const element of filteredArray) {
const [property, value] = element.split(':').map((part) => part.trim());

Choose a reason for hiding this comment

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

The split operation on element by colon is correct for separating property and value. However, note that handling multiple colons within a value is not required according to the additional prompt instructions.

Copy link

@vadiimvooo vadiimvooo left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants