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 #2663

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

add task solution #2663

wants to merge 2 commits into from

Conversation

edgergard
Copy link

No description provided.

Copy link

@dffUqp dffUqp left a comment

Choose a reason for hiding this comment

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

Almost done:smiley:

Comment on lines 11 to 13
for (const key in actions[i].extraData) {
state[key] = actions[i].extraData[key];
}
Copy link

Choose a reason for hiding this comment

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

we can make it easier by using Object.assign

@@ -5,7 +5,29 @@
* @param {Object[]} actions
*/
function transformState(state, actions) {
// write code here
}
for (let i = 0; i < actions.length; i++) {
Copy link

Choose a reason for hiding this comment

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

let's replace it with for...of

Comment on lines +23 to +25
for (const key in state) {
delete state[key];
}
Copy link

Choose a reason for hiding this comment

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

we clear all values from our object so can we just assign new empty object to avoid additional loop?

@edgergard edgergard requested a review from dffUqp August 3, 2023 10:41
Copy link

@Moroz-Dmytro Moroz-Dmytro left a comment

Choose a reason for hiding this comment

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

GJ 👍

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.

4 participants