network topology

How to judge whether parentId already exists, if not, do not continue to add

var markNumber = []; // 全局 变量
    var lastChildrenParent = parentId (sonId) .id;
    if (markNumber.includes (lastChildrenParent)) {
        return;
    } else {
        markNumber.push (lastChildrenParent)
    }
    console.log (lastChildrenParent);

 

Two: How to combine markBtn into one, including firstTop and lastTop at the same time, now they are separated twice and looped twice, just want to loop once

 

Solution: save the first value to the array, and then execute it again for the last time

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326046073&siteId=291194637