MVC - Model View Controller

// Model
class Task {
	constructor(description) {
		this.description = description;
		this.completed = false;
	}
}

// View
function renderTask(task) {
	console.log(`${task.description} - ${task.completed ? 'Completed' : 'Not Completed'}`);
}

// Controller
class TaskController {
	constructor(task, view) {
		this.task = task;
		this.view = view;
	}

	completeTask() {
		this.task.completed = true;
		this.view.render(this.task);
	}
}

// Usage
const task = new Task('Complete JavaScript Example');
const view = { render : renderTask };
const controller = new TaskController(task, view);

controller.completeTask();