-3

When I try to add a variable into a calling on a required value. I am trying to input the constant cookieinfo in to calling on a cookie value.

const cookieinfo = "bot" + result.bot

const config = require('/Users/Owner/Downloads/RankBloxCode/config');
const bloxy = require('bloxy');
const robloxClient = new bloxy.Client({
    credentials: {
        cookie: config.cookieinfo
    }
});

//Input
result.bot = abc
//Output
output = config.botABC

1 Answers1

0

unless I'm misunderstanding your problem, you must use bracket notation for dynamic keys (dot notation only works with static keys).

so config.cookieinfo has to be config[cookieinfo]

Rubens
  • 341
  • 1
  • 6