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

NW5- LEEDS - CUNEYT TURKER - JAVASCRIPT1 WEEK 3 - #128

Open
KptCnyt wants to merge 12 commits into
CodeYourFuture:mainfrom
KptCnyt:main
Open

NW5- LEEDS - CUNEYT TURKER - JAVASCRIPT1 WEEK 3#128
KptCnyt wants to merge 12 commits into
CodeYourFuture:mainfrom
KptCnyt:main

Conversation

@KptCnyt

@KptCnyt KptCnyt commented Sep 21, 2022

Copy link
Copy Markdown

No description provided.

@Ekremteke Ekremteke 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 Cuneyt. This PR is so impressive. When I struggled I looked at your PR. For Extra 2 you may look at mine as well if you want.😺

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

You did great Cuneyt, really happy with your progress, some areas I think you know are WIP etc but all in all a good effort. Let's finish those last exercises and smash this PR.


// Example 1
let a;
let a; // There is nothing equal with variable "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.

You're correct, I think maybe a language issue, the best way to say it is that there is no value assigned to variable "a". Just because equal sounds like "a === a" etc but I knew what you meant 👍


let hello = sayHello();
console.log(hello);
console.log(hello);// Variable defined but function must be defined too.

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 spotted, there are no parethesis console.log(hello())

}

sayHelloToUser();
sayHelloToUser(); // There must be a value inside of the paranthesis to make our function defined.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The function will be defined without a value, we're just calling it wrong, so you are correct we need a value.

// TODO
let output = [];
let i =0;
while(output.length<n){

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'm afraid this doesn't work Cuneyt, if I call this function with evenNumbers(10) it exceeds 10 in its return, it gives me:

[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]

Let me know if you want help with this one in the group chat.

// TODO
let output = []
for(let i of cities){
output.push(`The temperature in ${i} is ${temperatureService(i)} degrees`)

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 backticks here

let output = []
for(let i in allArticleTitles){

if(allArticleTitles[i].match(/[0-9]/g) !== null){

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 regular expressions, @Ekremteke actually simplified this with the /d operator. /d is a shortcut for 0-9 both are correct however I just felt it would be good to share that shortcut.

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.

That made sense, thank you.

for(let i = 0; i < allIntegers.length; i++) {
total += allIntegers[i];
}
let average = total / allIntegers.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 did great here, I would advise using new lines to help separate your code to help the readability. Split it up into chunks of separate logic.

Comment thread 2-mandatory/4-stocks.js
for(let j in i){
total += i[j];
}
let a = total/i.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.

I'm not a huge advocate for your variable naming here, you have i, j, a and b - Imagine if this code was 500 lines long, we'd need to study it closely to know what was happening.

Other than that, good job! There are a couple other ways to do this but you succeeded in completed the exercise.

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.

I really need to get used to it.

Comment thread 3-extra/1-factorial.js
function factorial(input) {
// TODO
let total = 1;
for(let index=input;index>0;index--){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Always remember to include spaces, they're not needed by the compiler or processor which reads the code, but it helps us read it better as developers 😅

I'm not sure you actually completed this task, we can talk about it in the hawk channel if you want.


function getHighestRatedInEachGenre(books) {
// TODO
for(let everyObjects of books){

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 you know this function isn't complete 😂

If you need help with this one, please talk in the hawk channel, myself and the others can help you out.

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.

3 participants