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

myscript.js

Hello, I am trying to do a function within a function, but it is not executing.

var world = "World!";

function sayHello () { var hello = "Hello ";

function inner () {
    var extra = " There is more!";
    console.log(world + extra);
}
inner();

}

Thank you for your help.

Could you please update your question? As it stands now, there is nothing there.

2 Answers

Veronika, you had forgotten to call your sayHello function. You called the inner function within the sayHello function, but since it's inside another function, sayHello must also be called.

var world = "World!";

function sayHello () {

var hello = "Hello ";

function inner () {
    var extra = " There is more!";
    console.log(world + extra);
}
inner();

}

sayHello(); // <-----

thank you!

No problem. :)