How to add comments to javaScirpt (JS) code in uniapp and vscode

Problem Description

When we declare a function and then call it, we will find that although the code prompts the typed value, there is no comment, which requires us to be clear about the definition of parameters and function names.

  • Function name: You can tell what it does at a glance
  • Parameters: You can know what parameters to type at a glance
    insert image description here

It's fine at first, but after a while, we might forget what our function is for.

How to add code comments

vscode version

Vscode adds comments with shortcut keys,
type:/**, there will be a code prompt automatically

practical demonstration
insert image description here
insert image description here

How to add code comments in uniapp

I have tested it for a long time and searched online for a long time, but there is no code comment

My solution is to put the function code header of uniapp in vscode, which will automatically generate comments in vscode, and then copy the written comments back.

Guess you like

Origin blog.csdn.net/qq_44695769/article/details/131108380