Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Samuel Llibre Santos
Samuel Llibre Santos
15,467 Points

This is how i make the exercise of table

Here is how i resolve the exercise of making table with a loop and pug

const express = require('express');

const app = express();

const names = [
    {name: 'Samuel ',
    lastName: 'Llibre Santos '},
    {name:'Aleksandra ',
    lastName:'Breway '},
    {name:'Wendy ',
    lastName:'Elton '},
    {name:'Elaine ',
    lastName:'Brightburn '},
    {name:'Samantha ',
    lastName:'Fleck '},

app.get('/sandbox', (req, res) => {
    res.render('sandbox', {names});

app.listen(3001, () => {
    console.log('The application is running on localhost: 3001!');

And here is the pug file

doctype html
    title Sandbox
        h1 Sandbox
        table(style='width:100%', border='1')
                th First Name
                th Last Name 
            each name in names
                    th= name.name 
                    th= name.lastName
        p An app to help you study

Want to know how other student do it ;).

Andrew Chalkley