Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
Javascript module - add documentation comments to a method

I have a module with a single method (or multiple, it doesn't matter for now):

(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        define([], factory(root));
    } else {
        root.fn = factory(root);
    }
})(typeof global !== "undefined" ? global : this.window || this.global, function (root) {
    'use strict';

    const my_method = (bar) => {
        console.log('bar', bar);
    }

    return {
        myMethod: my_method
    }
});

And I call it like follows:

fn.myMethod('foo');

My question is: Is there a way to document this method? (to know how it works when I call it from another code block - in an IDE tooltip, for example)

E.g.:

/**
 * How this method works
 * @param {any} bar
 */
const my_method = (bar) => {
    ...
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!