Call or access nested const inside variable in Javascript

i’m newbie in javascript but i need help, can i access or call from outside a variable inside const block ? here are the code :

  let selectedElement = _element.layer;
  const layerAttributes = {
    trait_type: _element.layer.trait,
    value: selectedElement.traitValue,
    ...(_element.layer.display_type !== undefined && {
      display_type: _element.layer.display_type,
    }),
  };
  console.log(layerAttributes);
  if (
    attributesList.some(
      (attr) => attr.trait_type === layerAttributes.trait_type
    )   
  )
    return;
  attributesList.push(layerAttributes);

};

I need to access layerAttributes from outside variable or const block, just in example access from console.log , inside block the console.log(layerAttributes); is working, but when i access from outside variable block is not working, any suggestion ?

Thanks in advance.