These submissions could be improved. Make sure you are not making the same mistakes.
Bad Branch updates
you MAY get this issue: nothing to submit
. If you do, you have merged your submission into master accidentally. To fix that issue:
git checkout master
git add
the file and commit
git checkout your-branch
git merge master
For loops
To prepare students for later chapters, we need to make sure students are well versed with recursion for these easy problems. Please redo your submissions using a recursive solution so you don't get lost in the later chapters.
Here's the section that talks about recursion: https://www.notion.so/JS-1-HTML-Functions-01dd8400b85f40d083966908acbfa184#be2575b8b21f4d97a0870c5e0ec01b09
const solution = (str, fun) => {
let i=0
return () => {
if (i >= str.length) {
i=0
}
let res = fun(str[i])
i+=1
return res
}
}
if (num <= 2)
return (num === 2) ? true : false;
This code has nested if logic, makes it hard for the next reviewer to follow your logic. Next time, try to identify complicated logic yourself and spending time thinking about it to make your code cleaner.