I have the following statement:
const queue = [
{name: "Click2Call"}
]
return queue.name
This returns null.
How can I fix it to return the object name?
What are you trying to do? This
queue:[{"name": "Click2Call"}]
is syntactically correct, but doesn't do anything. If you are trying to create a variable called queue you need to declare the variable with const or let (or var) and use the assignment operator =. For example:
const queue = [{"name": "Click2Call"}]
But this is also an array which doesn't have a name property. You need to access the first element of the array. For example:
return queue[0].name
queueis an array, you have to access the position before get the attribute.