Absolute beginner in Javascript here, trying to understand localStorage. My question is: If I want to display a string, let's say a name, in the place of the paragraph, using the code below or something very similar to it, how would I do that? Please correct my mistakes and fill in the dotted lines in your answer. (The use of localStorage would then mean that if I refresh the browser, the name would still remain, as I understand it). Thank you.
Code:
<!DOCTYPE html>
<html>
<head><title>Test</title></head>
<body>
<button onclick="abc();">Press to Play</button>
<p class="def"></p>
<script>
localStorage.getItem('...');
function abc () {
localStorage.setItem('...', '...');
document.querySelector('.def').innerHTML = ...;
}
</script>
</body>
</html>
