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 trialPowell Barrett
Full Stack JavaScript Techdegree Student 5,241 PointsNot sure what I have done wrong on Callback Function in JavaScript
Can someone take a look at my code and tell me what I have done wrong here, I keep getting a unexpected token on 1:9 where the parentheses is located
function () {
console.log("Hello World!");
}
functionRunner(log() => {
console.log("Hello World!");
});
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<link rel='stylesheet' href='styles.css'>
</head>
<body>
<section>
<p>Open your browser's console to see the results</p>
</section>
<script src='runner.js'></script>
<script src='app.js'></script>
</body>
</html>
function functionRunner(callback) {
callback();
}
1 Answer
Steven Parker
231,275 PointsIt looks like you made "log" anonymous, but instead of moving it into the call of "functionRunner" you put something else there (which doesn't have valid syntax).
Just move the new anonymous function into the call. When done, everything should be in the call.
Note that you don't need to convert to arrow syntax for this challenge.