Related:

* https://codereview.meta.stackexchange.com/questions/1709/why-is-hypothetical-example-code-off-topic-for-code-review
* https://codereview.meta.stackexchange.com/questions/594/is-pseudo-code-alright-when-asking-about-performance
* https://codereview.meta.stackexchange.com/questions/1981/the-gray-areas-of-code-review-hypothetical-example-code

My concrete examples usually contain some proprietary things. Even a variable name or package name can convey something that is not meant to be public.

**From Stack Overflow I've learnt to simplify, minimize, and isolate the problem.**  
*(ask specific questions, MCVE, ...)*

Examples of question one may want to ask:

> What is the recommended way of passing arguments to a function in JavaScript?

    var f1 = function(firstname, lastname) { ... };

    var f2 = function(options) { ... };

    f1("Michal", "Stefanow");
    
    f2({firstname: "Michal", "lastname": "Stefanow"});

It is hypothetical code, yet in my opinion it is a perfectly valid question about best practices in terms of code structure and readability.

Another one I would like to ask personally but I cannot post it to Code Review as it is hypothetical. And I cannot include the actual code because variable names convey some meaning and I want to avoid paying hefty compensation.

### What would be the best way to ask the question about following code?

**Option 1:**

    var iammicrowave = /(microwave)/.test(navigator.userAgent);
    if (iammicrowave) {
        var settings = { blah : 42 };
        magicFunction(settings);
    } else {
        magicFunction();
    }

**Option 2:**

    var iammicrowave = /(microwave)/.test(navigator.userAgent);
    var settings;
    if (iammicrowave) {
        settings = { blah : 42 };
    }
    magicFunction(settings);



**Option 3:**

    var iammicrowave = /(microwave)/.test(navigator.userAgent);
    var settings = imamicrowave ? { blah : 42 } : undefined; // or maybe {} here?
    magicFunction(settings);

---

Should I:

* Post on Code Review anyway?
* Post on Stack Overflow?
* Read more books?
* Make friends with developers who are better than me?

---

The actual question asked [here](https://softwareengineering.stackexchange.com/questions/299934/what-is-the-most-readable-way-of-passing-arguments-to-the-function).