London_9_Lovelace_Meysam_Arshadi_JS_Week_3 - #196
Conversation
| } | ||
| return title | ||
| } | ||
|
|
There was a problem hiding this comment.
Hi @Meysam-Arshadi
I fixed solution for titleWithFewestWords(allArticleTitles)
function titleWithFewestWords(allArticleTitles) {
// TODO
let fewestWordsSoFar
let titleWithFewestWords =''
for (let title of allArticleTitles) {
let numOfWords = title.split('').length
if (fewestWordsSoFar == undefined || numOfWords <= fewestWordsSoFar ) {
fewestWordsSoFar = numOfWords
titleWithFewestWords = title
}
}
return titleWithFewestWords
}
You can find all solutions here https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week3-Solution/blob/main/2-mandatory/3-financial-times.js
| num = num + 2; | ||
| n--; | ||
| } | ||
| console.log(arr); |
| // TODO - Write for loop code here | ||
| const AGES = [59, 40, 41, 63, 49]; | ||
|
|
||
| for (let i = 0; i < WRITERS.length; i++) { |
There was a problem hiding this comment.
nice! You can also use map when there is a transformation of an array into another array of the same size.
No description provided.