Binh Pham
Binh Pham

Reputation: 11

How do I get Visual Studio Code (VS Code) to show method preview of objects?

I've been following Traversy Media JavaScript crash course. I noticed that I couldn't get Visual Studio Code to show the methods of objects like he did. I searched and it said IntelliSense should automatically be turned on but it's not working for me. Any help?

https://youtu.be/hdI2bqOjy3c?t=3777

https://i.imgur.com/OPleMnc.mp4

Upvotes: 1

Views: 915

Answers (1)

Ivan Smialko
Ivan Smialko

Reputation: 144

You have some errors in your code that prevents IntelliSense to work normally:

function Person(dob){
    this.dob = new Date(dob); //semicolon here
}

const person1 = new Person('John', 'Doe', '4-3-1980'); //define that person1 (your p) is const variable, and semicolon

person1.dob.getDate(); //and your IntelliSense will prompt object methods normally

Upvotes: 1

Related Questions