View JS YouTube course

I’m following the Vue.js crash course on youtube (by Traversy Media), and I’m using VS Code to follow along the tutorial, but I’m having trouble with the function, data, and return tags.

Here’s a screenshot of my app.js page on Vs Code:

Why does the “function()” part marked red and how do I fix that?
On the crash course video, the guy uses “data()” instead of “function()” and it works fine.

1 Like

Please don’t post into threads unrelated to your question. I’ll move this into a new topic for you.

1 Like

Please include a link to the video and maybe a timestamp.
Also hover with the mouse over the underlined word and you should get an error message explaining the issue.
Oh and ofcourse please don’t post images but plain code.

…then use “data()” and not “function()”?

Here is the video: Vue JS Crash Course - YouTube at (11:19)

The message when I hover over the code says:

',' expected.ts(1005)
(method) function(): {
    firstName: string;
}

Right, here’s the code:

const app = Vue.createApp({
    template: '<h1>Hello {{firstName}}</h1>'
    function() {
        return {
            firstName:'John'
        }
    }

})

app.mount('#app')

That means you are missing a comma.