Another test & solution for #77#100
Another test & solution for #77#100seemcat wants to merge 2 commits intollipio:masterfrom seemcat:mc10
Conversation
| obj.consonant =+ 1; | ||
| } | ||
| console.log('obj', obj); | ||
| return obj; |
solutions/77.js
Outdated
| let i = 0; | ||
| let obj = {}; | ||
| while (i < string.length){ | ||
| if (string[i] === 'a' || 'e' || 'i' || 'o' || 'u'){ |
There was a problem hiding this comment.
Did you test your solution? I don't think this if condition would work: if (string[i] === 'a' || 'e' || 'i' || 'o' || 'u').
There was a problem hiding this comment.
You're right, it was wrong! I just fixed it 😸
solutions/77.js
Outdated
| let obj = {}; | ||
| while (i < string.length){ | ||
| if (string[i] === 'a' || 'e' || 'i' || 'o' || 'u'){ | ||
| obj.vowel =+ 1; |
There was a problem hiding this comment.
This operator also =+ would not work. Make sure to run npm run test
There was a problem hiding this comment.
Yes, I just fixed it! 😅
yjlim5
left a comment
There was a problem hiding this comment.
Address all comments made by reviewers first please.
| module.exports = {solution}; | ||
| const solution1 = (string) =>{ | ||
| let i = 0; | ||
| let j = 0; |
There was a problem hiding this comment.
This is a working solution. Good start! Now try to implement this solution without using extra variables j and k. Hint: initialize obj before entering the while loop.
| it('should return { vowel: 3, consonant: 4 } for "goodbye"', () =>{ | ||
| expect(solution1('goodbye')).to.eql({vowel: 3, consonant: 4 }); | ||
| }); | ||
| it('should return { vowel: 2, consonant: 3 } for "bonzo"', () =>{ |
There was a problem hiding this comment.
Can we replace this test case with a different scenario - like a word without 0 vowel or 0 constant?
No description provided.