Closed codingbootcampseu closed 2 years ago
alert()
Hints
Use the trim() method to remove leading and/or trailing spaces.
trim()
let str = " test "; str = str.trim(); // str is now "test"
You can use custom attributes to add additional information to HTML elements.
const li = document.createElement('li'); li.setAttribute('data-todo', newTodoText);
In JavaScript it is possible to dynamically add new keys to existing objects.
const li = document.createElement('li'); li.todo = 'your todo text';
Example Solution and Comparison
Fehlersuche ist was feines, besonders wenn man Stunden braucht festzustellen was der Fehler sein sollte.
alert()
box if the new todo is already in the listHints
Use the
trim()
method to remove leading and/or trailing spaces.You can use custom attributes to add additional information to HTML elements.
In JavaScript it is possible to dynamically add new keys to existing objects.
Example Solution and Comparison