var todos = [];
var field = document.querySelector('.new-todo');
var list = document.querySelector('.todo-list');

function addItem(itemContent){
	todos.push(itemContent);
	console.log(todos);
}

function deleteItem(itemContent){
	for(var i = 0; i < todos.length; i++){
		if(itemContent == todos[i]){
			todos.splice(i,1);
		}
	}
	console.log(todos);
}

function returnTodos(){
	return todos;
}

field.addEventListener('keypress', function (e){
	if(e.keyCode == 13 && field.value != ''){

		var item = document.createElement('li');
		item.textContent = field.value;
		item.className = 'todo-item';
		list.appendChild(item);

		field.value = '';
		addItem(item.textContent);
	}
}, false);

list.addEventListener('click', function (e){
	var item = e.target;
	list.removeChild(item);

	deleteItem(item.textContent);
}, false);
@@ -1,117 +1,440 @@
-var todos = %5B%5D;%0Avar field = document.querySelector('.new-todo');%0Avar list = document.querySelector('.todo-list');
+// localStorage.clear();%0Aif(localStorage.length == 0)%7B%0A%09localStorage.setItem('todos','%5B%5D');%0A%7D%0A%0Avar todos = JSON.parse(localStorage.todos);%0Avar field = document.querySelector('.new-todo');%0Avar list = document.querySelector('.todo-list');%0A%0Afunction checkList()%7B%0A%09if(todos.length != 0)%7B%0A%09%09for(var i = 0; i %3C todos.length; i++)%7B%0A%09%09%09var item = document.createElement('li');%0A%09%09%09item.textContent = todos%5Bi%5D;%0A%09%09%09list.appendChild(item);%0A%09%09%7D%0A%09%7D%0A%7D
 %0A%0Afu
@@ -489,27 +489,51 @@
 tent);%0A%09
-console.log
+localStorage.todos = JSON.stringify
 (todos);
@@ -669,25 +669,44 @@
 ;%0A%09%09
-%7D%0A%09%7D%0A%09console.log
+%09localStorage.todos = JSON.stringify
 (tod
@@ -702,32 +702,39 @@
 ringify(todos);%0A
+%09%09%7D%0A%09%7D%0A
 %7D%0A%0Afunction retu
@@ -756,16 +756,43 @@
 urn 
-todos;%0A%7D
+localStorage.todos;%0A%7D%0A%0AcheckList();
 %0A%0Afi
@@ -957,24 +957,27 @@
 ld.value;%0A%09%09
+// 
 item.classNa

Add todo list