SOURCE

    /**
     * 单例模式
     */
    class jquery {
        constructor(elment) {
            this.elment = elment
            this.instance = null
        }

        static init(elment) {
            if (!this.instance) {
                this.instance = new jquery(elment)
            }
            return this.instance
        }

        child() {
            console.log(this.elment + "插入方法")
        }

    }

    window.$ = (function(elment) {
        return jquery.init(elment)
    })

    $("p").child()
    $("b").child()

    let o1 = $("s")
    let o2 = $("d")

    console.log(o1 === o2)
console 命令行工具 X clear

                    
>
console