Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

update - #436

Open
mickeyhaile2 wants to merge 2 commits into
CodeYourFuture:masterfrom
mickeyhaile2:master
Open

update#436
mickeyhaile2 wants to merge 2 commits into
CodeYourFuture:masterfrom
mickeyhaile2:master

Conversation

@mickeyhaile2

@mickeyhaile2 mickeyhaile2 commented Nov 24, 2022

Copy link
Copy Markdown

Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in HOW_TO_MARK.md in the root of this repository

Your Details

  • Your Name:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?
    getting a function into a function

  • What do you still not understand?

  • Any other notes?


View rendered exercises/B-hello-world/README.md

@JDysiewicz JDysiewicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looking good so far, seems you're taking to JS well :D Careful of not using var (stick to const, or if necessary use let), and remember that variables in JS are case-sensitive.

@@ -1,3 +1,7 @@
// Start by creating a variable `message`
var message = "This is a string";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

try to avoid using var; it can cause issues with scoping https://www.freecodecamp.org/news/var-let-and-const-whats-the-difference/ (you're not expected to understand what this means currently, just here in case you're interested). Try to always use const, then, if the variable needs reassigning, delcare with let instead

Comment on lines +2 to +4
numberOfStudents = 15;
numberOfMentors = 8;
total = numberOfMentors + numberOfStudents

@JDysiewicz JDysiewicz Nov 26, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Variables in JavaScript need to be "declared"; this means you prefix the variable name with let or const (e.g. const numberOfStudents = x, let numberOfMentors = y. This is effectively letting JS know that numberOfStudents refers to a variable, instead of being some other key word. This is causing some tests to fail

@@ -1,7 +1,7 @@
function halve(number) {
// complete the function here
return Number*.5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

variables are case-sensitive; in this case you want to refer to the number variable; but instead you're referring to something called Number (which, incidentally, is a thing that exists in JS)

// Declare your function first

function name(a,b) {
return a/b

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What would happen if b = 0; you would execute a/0 - give this a try and see what happens; have a think about how you might handle that situation (note - this is more advanced than strictly necessary at this point, but it's always good to think ahead)

@@ -1,4 +1,7 @@
// Declare your function here
function createLongGreeting(a, b) {
return "I am " + a + " and I am " + b + " years old"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As a general comment, how might you rewrite this as a template string? Usually, template strings are preferred to string concatenation (especially when there are many variables involved), as it's usually more readable.

@JDysiewicz

Copy link
Copy Markdown
Member

Make sure to stick to the naming convention specified in the template for naming your PRs; it makes locating and organizing them far easier.

Comment thread mandatory/4-tax.js
Comment on lines 9 to +14
function calculateSalesTax() {}

function calculateSalesTax(sales) {
const calcTax = sales * 0.2 + sales;
return calcTax;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You're declaring the same function name twice here, which is why one of your tests is failing. You can remove the declaration on line 9.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants