【问题标题】:How do I get Visual Studio Code (VS Code) to show method preview of objects?如何让 Visual Studio Code (VS Code) 显示对象的方法预览?
【发布时间】:2019-10-09 15:51:33
【问题描述】:

我一直在关注 Traversy Media JavaScript 速成课程。我注意到我无法让 Visual Studio Code 像他那样显示对象的方法。我搜索了一下,它说 IntelliSense 应该自动打开,但它对我不起作用。有什么帮助吗?

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

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

【问题讨论】:

    标签: javascript visual-studio-code intellisense javascript-intellisense


    【解决方案1】:

    您的代码中有一些错误导致 IntelliSense 无法正常工作:

    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

    【讨论】:

      猜你喜欢
      • 2021-12-20
      • 1970-01-01
      • 2021-10-22
      • 1970-01-01
      • 2017-01-24
      • 2020-08-25
      • 2019-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多