Skip to content

Conversation

@seemcat
Copy link
Contributor

@seemcat seemcat commented Jun 12, 2017

No description provided.

obj.consonant =+ 1;
}
console.log('obj', obj);
return obj;
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove console.log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved!

solutions/77.js Outdated
let i = 0;
let obj = {};
while (i < string.length){
if (string[i] === 'a' || 'e' || 'i' || 'o' || 'u'){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you test your solution? I don't think this if condition would work: if (string[i] === 'a' || 'e' || 'i' || 'o' || 'u').

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This operator also =+ would not work. Make sure to run npm run test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I just fixed it! 😅

Copy link
Collaborator

@yjlim5 yjlim5 left a comment

Choose a reason for hiding this comment

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

Address all comments made by reviewers first please.

module.exports = {solution};
const solution1 = (string) =>{
let i = 0;
let j = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

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"', () =>{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we replace this test case with a different scenario - like a word without 0 vowel or 0 constant?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants