Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truthy and falsy - Result of value type(string) is wrong #31

Closed
brunokratka opened this issue Oct 16, 2017 · 3 comments
Closed

Truthy and falsy - Result of value type(string) is wrong #31

brunokratka opened this issue Oct 16, 2017 · 3 comments

Comments

@brunokratka
Copy link

On topic 'Truthy and falsy' chapter 1, both editions;

The description of value type(string) which you can see on example:

The result is false if the string is empty (length is 0); otherwise, the result is true (length > 1).

Can be verify on output as true when val.length is 1. Using the same function example, below the table of truthy and falsy, we can see:

function testTruthy(val){
    return val ? console.log('truthy') : console.log('falsy');
}

testTruthy('a');  //true
@loiane
Copy link
Owner

loiane commented Oct 16, 2017

Thanks Bruno! Will review it and get back to you.

@loiane loiane added the review label Oct 16, 2017
@xgqfrms-GitHub
Copy link

just using ES6!

const testTruthy = (str = ``) => (str !== `` ? console.log(`truthy = ${str}`) : console.log(`falsy = ${str}`));

testTruthy(`abc`);
// truthy
testTruthy(``);
// falsy
testTruthy();
// falsy

loiane added a commit that referenced this issue Oct 22, 2017
@loiane
Copy link
Owner

loiane commented Oct 22, 2017

Errata submitted for both editions. Exampled added and text will be corrected in next ed.

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

No branches or pull requests

3 participants