what does initValidation.validate mean?

why are we calling initValidation() and where is initValidation.validate stored ?

    function initValidation()
    {
        // irrelevant code here
        function validate(_block){
            console.log( "test", _block );
        }
    
        initValidation.validate = validate;
    }

    initValidation();
    initValidation.validate( "hello" );

3 thoughts on “what does initValidation.validate mean?”

  1. With this snippet you are doing this:

    1. declaring a function called initValidation
    2. calling the function initValidation that, when called, add to its definition the validate function, that is declared inside the function itself
    3. after the initialization, you call the validate function that, at this point, is defined as part of initValidation
    Reply

Leave a Comment