The HTML table does not display the data at all

I’m following a YouTube tutorial right now. I got the JSON data from API and want to show them on the HTML table. It does not show the data as I wanted (as per screenshot below):

Could anyone kindly give me a hint so I could fix this myself? For your reference my source code is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--bootstrap v5.1-->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <!--Vue.js-->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <!--Axios-->
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

    <title>CONFIDENCIAL - users</title>
</head>
<body>
    <div class="mt-4 container" id="app">
        <table class="table table-success table-striped">
        <thead>
            <tr>
              <th scope="col">#</th>
              <th scope="col">Name</th>
              <th scope="col">Title</th>
              <th scope="col">Body</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="post in posts" :key = "posts.userId">
              <td scope="row">{{ posts.userId }}</td> <!--find a way to display the data correctly. rn the program does NOT display it--> 
              <td>{{ posts.id }}</td>
              <td>{{ posts.title }}</td>
              <td>{{ posts.body }}</td>
            </tr>
          </tbody>
        </table>
    </div>
    <script>
        new Vue({
            el:"#app",
            data: {
                  posts: []
                
            }
        },
        created(){
            axios.get('https://jsonplaceholder.typicode.com/posts')
            .then(response => 
                this.posts = response.data
            )
            .catch(error => 
                console.log(error)
            )
        } 
        ) 
    </script>
</body>
</html>
<!--once done with replicating, add sorting buttons and display arrows :-) -->

Hello!

Your code has some issues:

  1. created have to be a field in Vue configuration object, but in your code it is outside of configuration object. See The Vue Instance — Vue.js for reference.
  2. Inside loop post in posts you have used posts array to access fields of single post instead of post object.

I recommend to use some IDE like VSCode (https://code.visualstudio.com/), which can highlight some typos and mistakes in code.

Hope I could help.

Thank you so much for your tips! They just helped me a lot. My table now perfectly displayed the post data. For the created I did use the VS Code and it gave me the problem like " comma expected." Still, I didn’t understand what exactly the error was. You pointed out some typos in there, which was also greatly helpful.