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

NW6 | Hadika Malik | Module JS1 | Week 4 #187

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

HadikaMalik
Copy link

@HadikaMalik HadikaMalik commented Dec 6, 2023

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Completed the week 4 exercises

Questions

I was confused a bit about count.test and is-prime.test.

Copy link
Contributor

@pseudopilot pseudopilot left a comment

Choose a reason for hiding this comment

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

Hi @HadikaMalik !
Great job and I see and appreciate your efforts 👍

Though, there is a room for improvements. I left some comments. Please, check them.

Comment on lines +2 to +7
let timeFormat = (Number(time.slice(0, 2)) - 12)
if (Number(time.slice(0, 2)) > 12) {
if (timeFormat < 10)
return `0${timeFormat}:${time.slice(3,5)} pm`;
else
return `${timeFormat}:${time.slice(3,5)} pm`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please watch code formatting. The alignment of each line is different which is not right.
Try using VS Code Extension Prettier which helps you to format your code on saving document.
Also some semicolons are missing (in the end of the first line). Prettier can help you with both problems.

Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is relevant to all the files.

Comment on lines +35 to +45
if (cardString > 1 && cardString < 11)
return +cardString;

else if (cardString === 'J' || cardString === 'Q' || cardString === 'K')
return 10

else if (cardString === 'A')
return 11

else
return 'Invalid card rank'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this solution is missing something (second part of the card string):

Given a card string in the format "A♠" (representing a card in blackjack),

Comment on lines +37 to +54
function properFraction(num,den){

if (den === 0)
return 'Error';

if (num < den)
return 'True';

if (num > den || num === den)
return 'False';

if (num < 0 && num < den)
return 'True';

if (num === den)
return 'False';

}
Copy link
Contributor

Choose a reason for hiding this comment

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

First of all, we shouldn't return 'True' and 'False' as strings. These should be boolean types true and false.
Secondly, you have 2 checks which return true, and 2 checks which return false. Could you please try to merge/combine them to have only one check instead (or at least 2)?

Comment on lines +44 to +52
if (a + b <= c || a + c <= b || b + c <= a)
return 'False';

else if (a <=0 || b <=0 || c <=0)
return 'False';

else if (a + b > c || b + c > a || a + c > b)
return 'True';

Copy link
Contributor

Choose a reason for hiding this comment

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

Firstly, same comment about true and false as above.
Secondly, try to combine the if blocks for this task too.
It is really possible to make it in 2 lines just like:

if (...) return false;
return (...);

Comment on lines +5 to +12

function getOrdinalNumber(number) {
if (number === 11){
return `${number}th`;
}
if (number%10 === 1) {
return `${number}st`;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it covers all possible cases 🤔 But the start is good!

Comment on lines +28 to +36
if (count > 0 ){
return str.repeat(count);
}
if (count === 1){
return str;
}
if (count === 0){
return " ";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to check all these 3 scenarios. count > 0 should be enough.

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.

2 participants