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

LONDON_10 | SAIM KORKMAZ | JS1-3 - #245

Open
nsaimk wants to merge 14 commits into
CodeYourFuture:mainfrom
nsaimk:main
Open

LONDON_10 | SAIM KORKMAZ | JS1-3#245
nsaimk wants to merge 14 commits into
CodeYourFuture:mainfrom
nsaimk:main

Conversation

@nsaimk

@nsaimk nsaimk commented Mar 7, 2023

Copy link
Copy Markdown

No description provided.


sayHelloToUser();
// user variable is not assigned, doesnt have a 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.

It is better to say that when we call the function, there is no any arguments - there's nothing in the brackets! Therefore value of the user parameter inside the function is undefined

// Example 4
let arr = [1,2,3];
console.log(arr[3]);
// arr is an array and index numbers 0, 1, 2. the other numbers is not index of arr. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, the array doesn't have any value at index 3 - it only has values at indexes 0, 1 and 2. Therefore, retrieving an element from index 3 will give us undefined

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

Good job! 👍

// TODO
let headlines = [];
for (let i = 0; i < allArticleTitles.length; i++) {
if (allArticleTitles[i].length <= 65) {

@IrynaLypnyk IrynaLypnyk Mar 15, 2023

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 know, that we can use for...of here as well ))

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

Super, you have done it!

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

to run tests just write in terminal from main directory
npm test 2-mandatory or
npm test 2-mandatory/3-stocks.js
Screenshot 2023-03-15 at 22 21 47

// TODO
const reports = [];
for (let i = 0; i < cities.length; i++) {
const report = `The temperature in ${cities[i]} is ${temperatureService(cities[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.

Good use of template literals!

let numberTitle = [];

for (let i = 0; i < ARTICLE_TITLES.length; i++) {
if (/\d/.test(ARTICLE_TITLES[i])) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of regex

Comment thread 2-mandatory/3-stocks.js
total += closingPricesForAllStocks[i][j];
}
const average = total / closingPricesForAllStocks[i].length;
resultArray.push(parseFloat(average.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.

Here, you are converting a number into a string and then back to a number.
I'm nit picking here, but you could use
Math.round(average * 100) / 100

Comment on lines +38 to +43
for (let i = 0; i < allFrequencies.length; i++) {
const frequency = allFrequencies[i];
if (isRadioStation(frequency)) {
radioStations.push(frequency);
}
}

@berkeli berkeli Mar 20, 2023

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 fine, but worth looking into .filter method in javascript.
(This will come later in the course, so only if you want a little bit of a challenge)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

Comment thread 3-extra/3-fibonacci.js
Comment on lines 16 to 24
function generateFibonacciSequence(n) {
// TODO
let result = [0, 1];
for (let i = 2; i < n; i++){
let totalOfPrevious = result[i - 1] + result[i - 2]
result.push(totalOfPrevious)
}
return result
}

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 fine and is one of the solutions for finding fibonacci numbers. Try learning about recursion and the solution for fibonacci numbers with recursion if you feel up to the challenge (this will come later, and is one of important topics in programming)

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

All looks good! great submission.

I left a few comments only for some further learning or extra challenges. Let me know if you want to discuss any of these

@berkeli berkeli added the reviewed A mentor has reviewed this code label Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

reviewed A mentor has reviewed this code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants