JavaScript function

hey everybody, I am an absolute beginner and i need your help because i can’t explain why this code doesn’t work.

I can write something in but as soon as I leave the field empty, it remains empty and does not accept the text “Enter Focus”.

I look forward to your tips

You probably want to also check if the local storage value is set to an empty string.

function getFocus() {
  const focus = localStorage.getItem('focus');
  if (focus === null || focus === '') {
1 Like