Never change the code provided in a question, under any circumstances whatsoever. You cannot know, if it's the cause ofyou are not already an expert in the specified problem, ortopic that the cause of a different problemquestion is about, meaning thatsimply because your edit could potentially deface the meaning of the question, if you just edit code without actually and no one likes thatfully understanding it.
Inline-Comments are an exception, but please do not change the actual code in questions. This only leads to confusion ("Your code is working fine!" [Post-Edit]) and anger ("Why did you fix the issue by editing instead of answering?").
Instead you should use an answer to point out typos or bad practices along with the solution. AlternativelyIf you cannot provide a solution, usepoint out typos or bad practices in a comment if you think that these points are too minor to be an answer or do not cause the main problem specified by the OPinstead.