Skip to content

NW6| BakhatBegum | CodeAlone-NumberFacts | API-Call Number fact | sprint- 2 - #28

Open
BakhatBegum wants to merge 1 commit into
CodeYourFuture:mainfrom
BakhatBegum:API-Call
Open

BakhatBegum wants to merge 1 commit into
CodeYourFuture:mainfrom
BakhatBegum:API-Call

Conversation

@BakhatBegum

@BakhatBegum BakhatBegum commented Feb 9, 2024 •

Copy link
Copy Markdown

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
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

  • Code along with the video
  • Make an API call to an external, public API
  • Display the response on the front end

Questions

What does the term 'event loop' mean? it is possible for you to provide a video on this topic, or perhaps organize one? Your clarification would be greatly appreciated. Thank you."

Comment thread script.js
// }
// }
// xhr.send();
// };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great work Bakhat, the point is to keep our codes clean, if you don't use them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you very much, @RbAvci but I need the code that is why I commented

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey @BakhatBegum I'm not sure why you need that code 👀
As a best practice for clean and maintainable code, remove unnecessary comments and consider alternative methods, such as separate documentation for future plans. You have already implemented the same logic using fetch at the bottom- which is most popular way for web development, so don't confuse yourself with the xhr.

@BakhatBegum BakhatBegum changed the title NW6| BakhatBegum | CodeAlone-NumberFacts | API-Call | sprint- 2 NW6| BakhatBegum | CodeAlone-NumberFacts | API-Call Number fact | sprint- 2 Feb 14, 2024
Comment thread script.js
// }
// }
// xhr.send();
// };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey @BakhatBegum I'm not sure why you need that code 👀
As a best practice for clean and maintainable code, remove unnecessary comments and consider alternative methods, such as separate documentation for future plans. You have already implemented the same logic using fetch at the bottom- which is most popular way for web development, so don't confuse yourself with the xhr.

Comment thread index.html
Comment on lines +11 to +14
<div class="container">
<div class="row">
<div class="col-md-6 mx-auto">
<div class="card bg-primary text-white mt-5 p-5">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I understand that you followed the tutorial. HOWEVER, this is a great example of the importance of semantic HTML and CSS. As you can see, there are several nested div elements but it's not always clear what their purpose is 😕
So, you don't need to change anything here. Just try to see how clean code is important.

Comment thread script.js
// here is the fetch function

function getFactFetch(){
let number = numberInput.value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would use "const" here.

Comment thread script.js
const fact = document.querySelector("#fact");
let fackText = document.querySelector("#factText");

let numberInput = document.querySelector("#numberInput");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would use "const" here.

Comment thread script.js
@@ -0,0 +1,40 @@
const fact = document.querySelector("#fact");
let fackText = document.querySelector("#factText");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am not sure if this is going to change, but I would start with const here.

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.

3 participants