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

London 10 | Shahid Amin | JavaScript-Core-1-Coursework-Week3 #277

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Schboostie
Copy link

No description provided.

@@ -21,7 +21,7 @@ function sayHello() {

let hello = sayHello();
console.log(hello);

//There is no value passed to the function sayHello

Choose a reason for hiding this comment

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

Good, but not every function will have parameters. There's something missing inside the function sayHello for it not to be undefined. Can you spot what it is?

Choose a reason for hiding this comment

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

A little hint

let numbers = []; // add numbers from 1 to 10 into this array
let mentors; // Create an array with the names of the mentors: Daniel, Irina and Rares
let numbers = [1,2,3,4,5,6,7,8,9,10]; // add numbers from 1 to 10 into this array
let mentors = ["Daniel", "Irina", "Rares"]; // Create an array with the names of the mentors: Daniel, Irina and Rares

Choose a reason for hiding this comment

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

Nice.

}

function last(arr) {
return; // complete this statement
return arr[arr.length - 1]; ; // complete this statement

Choose a reason for hiding this comment

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

👍

Comment on lines +29 to +33
AGES.forEach(k => {
WRITERS.forEach(i => {
console.log(i + " is " + k + " years old")
})
})

Choose a reason for hiding this comment

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

This doesn't look correct. Currently, it will say that every writer is 59,40,41,63 and 49 years old.

Comment on lines 20 to +26
// TODO
for (let dateOfBirth of BIRTHDAYS) {
let getMonth = dateOfBirth.split(' ')[0];
if (getMonth === "July") {
return dateOfBirth;
}
}

Choose a reason for hiding this comment

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

Good job on this.

@@ -5,7 +5,12 @@
Implement the function below, which will return a new array containing only article titles which will fit.
*/
function potentialHeadlines(allArticleTitles) {
// TODO
const shortArticleTitles = [];
for (let articleTitle of allArticleTitles) {

Choose a reason for hiding this comment

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

indentation seem off here too.

Choose a reason for hiding this comment

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

Good job overall code inside the function will work correct but it doesn't seem to output a value. You are definitely missing something here.

@@ -14,7 +19,16 @@ function potentialHeadlines(allArticleTitles) {
(you can assume words will always be seperated by a space)
*/
function titleWithFewestWords(allArticleTitles) {
// TODO
let fewestword = allArticleTitles[0].split(' ').length;

Choose a reason for hiding this comment

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

Well done.

@@ -8,6 +8,8 @@

let numbers = [1, 2, 3]; // Don't change this array literal declaration

numbers[3] = numbers.push(4)
//The first value is 1???

Choose a reason for hiding this comment

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

Good spot I'll forward that observation. But if it wasn't a 1 how would you change its value?

Comment on lines +60 to +72
let arrayOfLengths = allArticleTitles.map(w => w.length);
console.log(arrayOfLengths)
let sumOfLengths = 0;
for (let i = 0; i < arrayOfLengths.length; i++) {
sumOfLengths += arrayOfLengths[i];
console.log(sumOfLengths)
}

let sumOfArrayLengths = arrayOfLengths.length
console.log(sumOfArrayLengths)

let result = sumOfLengths/sumOfArrayLengths;
console.log(result)

Choose a reason for hiding this comment

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

Indentation is off here too.

averageprice.push(Math.round(average * 100) / 100);

}
return averageprice;

Choose a reason for hiding this comment

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

Good effort. Please make sure you indent your code correctly.

Functions for the radio station and the books completed.
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