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

London Class_8 - Deago Browne - JS - Week_1 - #244

Closed
DeagoBrowne wants to merge 4 commits into
CodeYourFuture:masterfrom
DeagoBrowne:master
Closed

London Class_8 - Deago Browne - JS - Week_1#244
DeagoBrowne wants to merge 4 commits into
CodeYourFuture:masterfrom
DeagoBrowne:master

Conversation

@DeagoBrowne

@DeagoBrowne DeagoBrowne commented Dec 15, 2021

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: Deago Browne
  • Your City: London
  • Your Slack Name: Deago Browne - Trainee

Homework Details

  • Module: JS1

Notes

  • What did you find easy? Most of the early exercises, and most of the npm Tests

  • What did you find hard? Percentages - though I managed to get it done, and I also found some formulas to use in the future

  • What do you still not understand? Couldn't add the "£" to the Tax function - gave up, as it was time-consuming, and I have other assignments to complete

  • Any other notes?


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

@RitaGlushkova RitaGlushkova 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.

Hi Deago, as part of our assignment I decided to review your code. I hope you don't mind. Great work! I like how you assign all functions' calls to variables. In my view, it is a very good practice. An overall note would be about using let or const instead of var.
I think if we developed this practice from the beginning we are less likely to cause bugs in the future. Var allows people to completely overwrite it, not just assign a new value. That's why when working in a team, it will be less risky to use let or const.

Comment thread mandatory/4-tax.js


function addTaxAndFormatCurrency(x) {
return (x + 0.20*x).toFixed(2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi Deago, well done for fixing it. If you want to add a pound sign, think of it as a "string" that you add with + in your return formula.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It can be rewritten like this:

return (1.2 * x).toFixed(2);

// Add comments to explain what this function does. You're meant to use Google!
function getRandomNumber() {
return Math.random() * 10;
// returns a random number between 1 <1, then multiplies that number by 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi Deago, I think there is a typo. Did you mean from 0 to < 1?

function getStringLength(word) {
return "word".length();
var sentence = "A wild sentence appeared!";
var word = "Turtles";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your variable is declared correctly. I would recommend using let instead. Because if you work with someone else on a very big piece of code, another person might come up with the same variable name word and without knowing rewrite yours. It will then can then cause a problem.

function multiply(a, b, c) {
a * b * c;
return;
return a * b * c;;

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 think there is an extra ;

@mahsa2 mahsa2 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.

Well done on finishing the assignment 💯 👏

@@ -1,3 +1,5 @@
// Start by creating a variable `message`
var myName = "Deago";
var nameLength =`My name is Deago, and my name is ${myName.length} characters long`;

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 use of concatinating string here ⭐

  1. Also you can use this to add your name.
  2. var -> const (or let if the value changes)
const nameLength = `My name is ${myName}, and my name is ${myName.length} characters long`;


const name = " Deago ";
nameLength = name.length
var message = `My name is ${name.trim()} and my name is ${name.trim().length} characters long`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could store the name.trim() in the variable:

let name = " Deago ";
name = name.trim();
nameLength = name.length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You need to use semicolom

@@ -1,7 +1,7 @@
function halve(number) {
// complete the function here
return number / 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

;

}

var result = halve(12);
var result = halve(512);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

console.log(halve(512));

@@ -1,5 +1,5 @@
function triple(number) {
// complete function here
return number * 3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

;

@@ -1,4 +1,8 @@
// Write your function here
function createGreeting (a) {
return "Hello, my name is " + a

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's better to use this format in general.

return `Hello, my name is ${a}`;

return b.toUpperCase();
}

function message (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.

message (b) -> message(b) (no space)


function introduceMe(name, age)
return "Hello, my name is " + name "and I am " age + "years old";
var name = "Sonjide";

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 is not needed in the test.

}

function concatenate(firstWord, secondWord, thirdWord) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No new line needed at the begining of the function.

Comment thread mandatory/4-tax.js


function addTaxAndFormatCurrency(x) {
return (x + 0.20*x).toFixed(2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It can be rewritten like this:

return (1.2 * x).toFixed(2);

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants