Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introducing the Practice

'statement expected' error

I keep having an issue right after the first ' if ' statement. I can't figure out what's causing it.

function addInventory ( product, addInventory ) {
    addInventory = parseInt(addInventory);
    if (product.toLowerCase() === 'name' && isNaN(addInventory) === false); {
        inventory += addInventory;
        console.log(inventory);
    } // Right after this closing bracket it says 'statement expected' 
      else if (product.toLowerCase() !== 'name') {
        console.log('There is no product named ' + product + '. Please try again.');
    } else if (isNaN(addInventory)) {
        console.log('Please enter the number of products you would like to add:');
    }
}

1 Answer

try removing the semicolon from this line towards the end: if (product.toLowerCase() === 'name' && isNaN(addInventory) === false); {