I wrote a colon in front of the function, and I saw a code with some name (I forgot the URL of the site I saw),
What is this?
Also, what is the effect of writing this?
Please teach me.

Applicable source code
setup: function (Id, initialize) {
  • Answer # 1

    Using objects-JavaScript | MDN

    ↑ See "Using Object Initializers".

  • Answer # 2

    Are you just starting out with some of the element settings for these objects?

    const x = {setup: function (Id, initialize) {}}
    console.log (x);

  • Answer # 3

    Maybe tkturbo's answer is good.

    JavaScript is also object-oriented, but it is called prototype-based, and it seems to be different from the method of building classes like C ++ or Java.

    Class base is for example

    class Test {
                  void method1 (void);

    , the object generated from the Test class has only method1,

    for JavaScript
    // As a prototype of the C ++ version above
    var test = new Test ();
    test.a = 100;//<-C ++ or other error process

    It looks like you can add new methods and fields as if they had originally existed.

    . In the above JavaScript, test.a is used as a field (variable).
    Method is also possible.


    b = test.method100 ();
    If you try to use a function that doesn't exist like

    , it cannot be processed because there is no definition.
    So it needs to be defined.

    Like tkturbo's one,

    Set later. I wonder if this is the case.