0

I have following expression in my code (React, Appolo, GraphQl):

events: {global: {worker_lname: `='somebody'`, ORDER_BY: ['timestamp DESC, id DESC']}}

I want to know if is it possible to use that piece of code like this:

let myvar=worker_lname: `='somebody'`;
events: {global: {myvar, ORDER_BY: ['timestamp DESC, id DESC']}} 
2
  • 1
    Surely you can try and see that it doesn't work. Why ask that? Commented Feb 19, 2021 at 11:28
  • 1
    I've tried and it doesn't. Please help. Commented Feb 19, 2021 at 11:31

1 Answer 1

2

you can do something like this:

let worker_lname = 'somebody';
var events = {global: {worker_lname, ORDER_BY: ['timestamp DESC, id DESC']}};
console.log(events);
//
{
   global: {
    ORDER_BY: ["timestamp DESC, id DESC"],
    worker_lname: "somebody"
   }
 }
Sign up to request clarification or add additional context in comments.

1 Comment

@noszone was the answer useful? If so, can you please accept it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.