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

JavaScript error (Uncaught SyntaxError: Unexpected end of input)

This is a lesson code. How can I get this error on the first line?

//Problem: User interaction doesn't provide desired results.
//Solution: Add interactivty so the user can manage daily tasks.

var taskInput = document.getElementById("new-task"); //new-task
var addButton; // first button
var incompleteTaskHolder = document.getElementById("incomplete-tasks"); //incomplete-tasks
var completerTasksHolder = document.getElementById("completed-tasks"); //completed-tasks


//Add a new task
var addTask = function () {

  //When the button is pressed
  //Create a new list item with the text from #new-task:
    //input (checkbox)
    //label
    //input (text)
    //button.edit
    //button.delete
    //Each elements, needs modified and appended
}

//Edit an existing task

var editTast = function () {
  //When the Edit button is pressed
    //if the class of the parent is .editMode
      //Switch from .editMode
      //label text become the input's value
    //else
      //Switch to .editMode
      //input value becomes the label's text

    //Toggle .editMode on the parent
}
//Delete an existing task
var deleteTask = function () { 
  //When the Delete button is pressed
    //Remove the parent list item from the ul

//Mark a task as complete
var taskComplete = function () {
  //When the checkbox is checked
    //Append the task list item to the #completed-tasks
}
//Mark a task as incomplete
var taskIncomplete = function () {
  //When the checkbox is unchecked
    //Append the task list item to the #incomplete-tasks
}

1 Answer

You missed a closing curly bracket at the deleteTask variable.

var deleteTask = function () { 
  //When the Delete button is pressed
    //Remove the parent list item from the ul
}

Wow JS is complex.... Why didn't it show the correct line on which the error was present?

That's how the console works, we just have to live with it.

Try to memorize certain error messages with common problems that occur, for instance with the one you had - I was only looking for not closed variables, functions etc.