Question: ```
    app.post(' /', urlencodedParser, function(req, res) {
      res.render('load', {data: req.body});
      var token = req.body.token;
      require('./loader.js')
    });

```

How can I provide variable "token" to loader.js?

Answer: 
```
function validBraces(braces){
    let par =0;
    let bra =0;
    let cur =0;
    for(let i =0; i<braces.length; i++){
        if(braces[i]==="("){
            par++;
        }
        if(braces[i]===")"){
            par--;
        }
        if(braces[i]==="["){
            bra++;
        }
        if(braces[i]==="]"){
            bra--;
        }
        if(braces[i]==="{"){
            cur++;
        }
        if(braces[i]==="}"){
            cur--;
        }
    }

    if(par<0 || bra<0 || cur<0){
        return false;
    } 
    return true;
};

```
Here is my solution:

```
var isValid = function (s) {
  let charMap = new Map();

  for (let i = 0; i < s.length; i++) {
    charMap.set(s[i], i);
  }

  return Boolean(
    charMap.get("(") < charMap.get(")") &&
    charMap.get("(") % 2 != charMap.get(")") % 2 &&
    charMap.get("{") < charMap.get("}") &&
    charMap.get("{") % 2 != charMap.get("}") % 2 &&
    charMap.get("[") < charMap.get("]") &&
    charMap.get("[") % 2 != charMap.get("]") % 2
  );
};

```

Explanation:

1. In order to achieve a quick and short solution, I have identified the common pattern of validity for opening/closing braces.
2. The common pattern for opening and closing braces' validity is that if say the opening(closing) stands at the even index in the string, the other one should be odd and vice versa. Example {}, {[]}, {()[]}, {[()]}.
3. Because we want to avoid a double loop for performance reasons, we are using a Hash Table via Map() to store the character and the index.
4. An alternative for getting the character's index would be using Array's find or another method, but that would end up in a second loop over the values which we want to avoid.
5. Finally, once the indexes of and the characters are stored in the charMap, we check whether or not the stored closing/opening characters' standing (odd/even) in the string is not equal, e.g. if '(' is odd the ')' should be even and vice versa.
6. We check this via the remainder (%) operator, i.e. a number's remainder of 2 is 0 if even.
7. Additionally, we need to check whether the order of braces is correct, e.g. if '(' is before '}';
8. The Boolean() function coerces the comparisons in the desired result.