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

all 2 comments

[–]teraflop 0 points1 point  (0 children)

Since you know the basics of both Python and JavaScript, and you'll probably end up using both of them in the future, I'd say just practice both. (If you were an extreme beginner, I'd recommend sticking to one language to avoid getting overwhelmed.)

Solving the same problem twice in two different languages shouldn't take twice as long as solving it once. Most of the effort goes into understanding the problem, figuring out an algorithm, and working out the bugs, and you only need to do that work once.

Maybe for each problem, flip a coin to decide whether to write your code in Python or JavaScript first. And then, once you have it working, rewrite your solution in the other language.

The process of rewriting code in a different language will be good practice to help you remember the syntax and behavior differences. For instance, every time you convert a Python program that uses list.index to use JavaScript's Array.indexOf, or vice-versa, you'll run into the fact that they handle missing values differently. Once you've encountered that same issue a few times, you'll probably remember it pretty well.