Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 9, 2022 10:00 am GMT

Develop JavaScript apps 200x faster w/ @params and vscode.

Typescript has been voted 4th place as the most loved or dreaded language in the StackOverflow survey 2022, which is props actually to Microsoft, if there is one thing they have mastered is creating elegant and fun programming languages.

Besides being elegant, Typescript + the vscode IntelliSense equals Absolute .

via GIPHY

one of the few reasons TS is so loved.

but what does all this have to do with JavaScript, @ params, and being 200x faster?

The absolute fire of TS && vscode IntelliSense, is absolutely the same fire we get w/ @ param + Javascript and vscode, done right you may fall in love with JavaScript even deeper.

example of the IntelliSense in action:

Image description

@ Param

I think it's time I admit @ param is kinda clickbaity, it's part of a larger concept of JSdocs, @ params is well-known and recognizable I had to use it.

JSDoc

defined as a quick start to documenting JavaScript.

besides documenting your code, JSDoc provides a way for vscode to understand your JavaScript, that's where the magic happens, the beautiful IntelliSense.

@ type example

JSDoc has these @ annotations that describe your code, @param being one of them, @type defines the type of a variable. for example, annotating a string.

w/o JSDoc

Image description

with JSDoc

Image description

Becoming 200x faster

JSDoc and HTML elements

you can document any element and get free code completion.

Image description

gif example: code completion

Image description

JSDoc and Primitive types

/** * @type {String} */let str; /** * @type {Array} */let arr;/** * @type {Object} */let obj; /** * @type {Number} */let num;/** * @type {Boolean} */let bool;

JSDoc and complex Arrays or Objects

more of the documenting side than code completion.

/** * @type {Array<String>} */let arr = []/** * @type {{a: String, b: Number}} *  */let obj;

JSDoc and functions

Image description

You can go deeper or wide as you want, and get free code completion. JSDoc was designed for documentation, allowing developers to communicate the functionality of their JS code and their types, vscode just leveraged it for IntelliSense.

Outro

JSDoc is a neat trick to know, to learn more you can visit their site for in-depth documentation and more cool features.

enjoyed the article? and wondering if you can support me, which I will truly appreciate and goes a long way, you can buy me a coffee.

Buy Me A Coffee

I also have a practical tutorial dropping soon, building a mobile app in React from scratch to production, with monetization, remote DB, auth, and all that good stuff more info here.

with that, have a good day or night. Thanks for reading!


Original Link: https://dev.to/sfundomhlungu/develop-javascript-apps-200x-faster-w-params-and-vscode-43pn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To