instanceof和typeof的區(qū)別 instanceof是什么意思?
instanceof是什么意思?您好,這個(gè)關(guān)鍵字的用法是:a instance of B,返回值是boolean type,用來(lái)判斷a是B的instance object還是B subclass的in
instanceof是什么意思?
您好,這個(gè)關(guān)鍵字的用法是:a instance of B,返回值是boolean type,用來(lái)判斷a是B的instance object還是B subclass的instance object。如果是,則返回true;否則返回false。例如:person P=new person()//man M=new man()//man是person的子類。Animal a=new Animal()m instanceof man//返回Animal的true實(shí)例//返回person的false實(shí)例//返回true