0

クラス内からオブジェクトを見つけるにはどうすればよいですか?

これは私のスタンドアロン JavaScript コンポーネントです。

function User(first, last){
    if (this instanceof User){
        this.name = first + " " + last; 

        //Is there a way here to find either User objects here? (John or Jane)
        //How would I changed to the desired User object and start working with it?
    }
    else return new User(first, last);
}

クライアントコードには、次のものがあります。

User("John", "Smith");
User("Jane", "Doe");
4

1 に答える 1