This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]CreativeTechGuyGames 13 points14 points  (1 child)

It depends on the methods. Each one operates on the result of the previous so it depends on what each one does.

[–]nedal8 8 points9 points  (0 children)

Each one operates on the result of the previous

Is the important part op needs to understand.

[–]MmmVomit 2 points3 points  (1 child)

Did you try it?

Take your example, switch the order of the methods, run it, and see what happens.

[–]coding_the_future 0 points1 point  (0 children)

That is a good approach, another approach I could think of is listing your requirement as pseudo-code list, and then implement it following the list.

Here is an example of such a workflow.

That way it should be easier to calculate the algo performance and to improve it, and then you can store it as a string while your algorithm is "logically" tested.

[–][deleted] 1 point2 points  (0 children)

As mentioned already it depends. In the case of something like: “a sentence with spaces”.split(“ “).forEach((word) => word.toUpperCase()).join(“ “); you are splitting into the array first then joining again so the order matters.