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: 
As Dave suggested, using a stack, I've wrote the code for it:

```
var leftBraces="([{";
var rightBraces=")]}";

function checkBraces(braces) {
  var ok=true;
  var stack=[];
  for(var i=0; i<braces.length && ok; i++) {
    var brace=braces[i];
    if(leftBraces.includes(brace)) stack.push(brace);
    else {
      var leftBrace=stack.pop();
      if(leftBrace==undefined) ok=false;
      else if(leftBraces.indexOf(leftBrace)!=rightBraces.indexOf(brace)) ok=false;
    }
  }
  if(stack.length) ok=false;
  return ok;
}

```

Code assumes only braces (no spaces or other characters).  

I'm using `string.indexOf()` that matches for `leftBraces` and `rightBraces`.  

Also, within the `for` loop, notice the termination part (2nd): `i<braces.length && ok` - doesn't "have to" use the iterator and, if I'm not mistaken, can even be empty...
```
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;
};

```