Question: I am trying to run a very simpe code on js thats should add elements to an array from a prompt, but nothing happens. Here is the code:

HTML:

```
<body onload="loadBooks()">

<button onclick="myFunction()">Add your Favourite</button>

<p id="books"></p>

```

JS:

```
var books= ["Little Prince","The Alchemist","Alice in Wonderland"];
function loadBooks(){

document.getElementById('books').innerHTML= books;

}

function myFunction(){

var book= prompt("What is your favourite book?");

books[books.lenght]=book;

document.getElementById("books").innerHTML= books;

}

```

What is wrong with it?

Answer: 
You have misspelled `length` (you spelt it `lenght`).

The canonical way is to use `var new_length = array.push(elements...)` like this:

```
books.push(book); 

```
Fixed your code and done little improvement-

```
<script>
    // your custom ajax request here
    var books = ["Little Prince", "The Alchemist", "Alice in Wonderland"];
    function loadBooks() {
        document.getElementById('books').innerHTML = books;
    }

    function myFunction() {
        var book = prompt("What is your favourite book?");
        books[books.length] = book;
        loadBooks();
    }
</script>

<body onload="loadBooks()">
    <button onclick="myFunction()">Add your Favourite</button>
    <p id="books"></p>
</body>

```