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

London 9 olus odude js1 wk1 - #413

Open
OlushoreOdude wants to merge 20 commits into
CodeYourFuture:masterfrom
OlushoreOdude:master
Open

London 9 olus odude js1 wk1#413
OlushoreOdude wants to merge 20 commits into
CodeYourFuture:masterfrom
OlushoreOdude:master

Conversation

@OlushoreOdude

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: Olus
  • Your City: london
  • Your Slack Name: olushoreodude

Homework Details

  • Module: javascript
  • Week: wk1

Notes

  • What did you find easy?
    function were ok,

  • What did you find hard?

  • trying to find the best method for decimalising a price

  • an efficient setup for running test with node

  • What do you still not understand?

  • if jest needs to be installed in every new project or if their is a way to reference it from a separate repository

  • when is best to commit when working on functions

  • Any other notes?
    only mandatory folder has been completed, the rest will follow

@OlushoreOdude
OlushoreOdude marked this pull request as draft November 20, 2022 16:31
@OlushoreOdude
OlushoreOdude marked this pull request as ready for review November 20, 2022 16:32
@maxf
maxf self-requested a review November 20, 2022 16:32

@maxf maxf left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very good start with JS. A few minor comments.

@@ -1,3 +1,5 @@
// Start by creating a variable `greeting`

let greeting = "Hello World";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small detail: the variable's value doesn't change, so you might as well use const, just so it becomes a habit.

let bRail = pound * 5.7;
console.log(bRail);
let railAndFee = bRail * 0.99;
console.log(railAndFee);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hint: when you have multiple console.log in your code it can become confusing which one is printing which value. So you can use instead:
console.log("value of bRail", bRail);
or
console.log('Here>', railAndFee)

This works because console.log() takes any number of arguments and prints all of them. For instance,
console.log('Hello', 'World', 3.14)

return "Hello, my name is " + name "and I am " age + "years old";
function introduceMe(name, age) {
return "Hello, my name is " + `${name}` + " and I am " + `${age}` + " years old";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This works, but is a bit convoluted :)

I think the idea was to add the missing + and whitespace characters


function getTotal(a, b) {
total = a ++ b;
total = a + b;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

use const. Even if the variable is declared without const or let, it's a bad idea not to use either.

expect(introduceMe("Sonjide", 27)).toEqual(
"Hello, my name is Sonjide and I am 27 years old"
);
expect(introduceMe("Sonjide", 27)).toEqual("Hello, my name is Sonjide and I am 27 years old");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why has this changed?

expect(trimWord(" CodeYourFuture teaches coding ")).toEqual(
"CodeYourFuture teaches coding"
);
expect(trimWord(" CodeYourFuture teaches coding ")).toEqual("CodeYourFuture teaches coding");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why this change?

//the number is never equal to 1. times the nubmeer by 10
//creates a random numbere between 0 and <10.
/*
google say : The Math.random() function returns a floating-point, pseudo-random number that's greater than or equal to 0 and less than 1, with approximately uniform distribution over that range — which you can then scale to your desired range

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not google :) Mozilla Developer Network - the best reference

Comment thread mandatory/4-tax.js
Comment on lines +7 to +22
/*
// function does decimaal conversion and tax
function calculateSalesTax(price) {
//convert number to decimall place twin
let newPrice = price.toFixed(2);
//convert numb form string back to numb
let usePrice = newPrice * 1;
console.log(typeof usePrice);
console.log(usePrice);
let taxPrice = usePrice * 1.2;
let showPrice = taxPrice.toFixed(2);
console.log(showPrice);
return `£ ${showPrice}`;
}
calculateSalesTax(15);
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants