Проблемма с добавлением и извлечением данных из массива JavaScript
У меня возникла проблема при добавлении элемента в массив.
let editors = [];
function CreateEditor(){
const editorsAll = document.querySelectorAll('.comment_editor');
let edit;
for(let editor of editorsAll){
const script_id = `${editor.id}_script`;
const labelName = document.querySelector(`[for$="editor.id"]`);
editor.nextSibling.remove();
if(labelName){
labelName.style.float = "none"
}
let text = document.getElementById(script_id).textContent;
const config = JSON.parse(
text,(key, value) => {
if(value.toString().includes('/')){
return new RegExp(value.replaceAll('/',''));
}
return value;
}
);
ClassicEditor.create(editor,config).then(response => {
editors.push(response.data)
});
}
}
document.addEventListener('DOMContentLoaded', () => {
CreateEditor();
console.log(editors)
});
console.log(editors) выводит Array[] то есть не добавляется в него ни чего. Однако если посмотреть дальше при нажатии на стрелке то будет это
Подскажите что не так и как можно решить данную проблему?
