首页 > 解决方案 > 未捕获的类型错误:无法读取 null 的属性(读取“长度”)

问题描述

我的代码不断吐出这个错误,它在 VS 代码中有效,但在托管服务器中无效。如果我能得到另一双眼睛,那就太好了。

(index.js file)

if (Firstchild.tasks.length !== null) {
    Firstchild.load();
    Firstchild.render();
}

(taskmanager.js file)

    render() {
        clearBox();
        const tasksHtmlList = [];
        for (let i = 0; i < this.tasks.length; i++) {
            const firstVariable = this.tasks[i];
            const date = new Date(firstVariable.dueDate);
            date.setDate(date.getDate() + 1);
            const formattedDate = date.toDateString();
            const taskHtml = createTaskHtml(firstVariable.id, firstVariable.taskTitle, firstVariable.description, firstVariable.assignedTo, formattedDate, firstVariable.taskStatus)
            tasksHtmlList.push(taskHtml);
        }

标签: typeerror

解决方案


推荐阅读