Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PAR Ghaith & Diane#409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Dianedel wants to merge1 commit intoironhack-labs:masterfromDianedel:master
Closed

Conversation

@Dianedel
Copy link



functionfindLongestWord(words){
varmaxLengthWord=words[0].length;

Choose a reason for hiding this comment

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

You should assign an empty value to this variable, per exempl :

varmaxLengthWord=""

It's better, because words (your array) can be empty, so you won't be able to refer to the index 0 of the Array, if you use this, it will remove some error from jasmine :)

functionfindLongestWord(words){
varmaxLengthWord=words[0].length;
for(vari=0;i<words.length;i++){
if(words[i].length>maxLengthWord){

Choose a reason for hiding this comment

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

To stick to the expectation of the test, you should add an if that manage to return undifined if the array is empty

Choose a reason for hiding this comment

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

  • you are missing something in the if statement, as you are comparing the length of a word with a word (and not with the length of this word), it should be :
words[i].length>maxLengthWord.length

@ta-web-paris
Copy link

As I told you you have to stick to requirement of the jasmine (typo, ect..), to remove some error that are still there, you have to deal with some special case (empty array per exemple).

Otherwise your code is good ! 👍

If you have any question, let me know :)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@dudydudedudydudedudydude left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@Dianedel@ta-web-paris@dudydude

[8]ページ先頭

©2009-2025 Movatter.jp