instanceofcheck what a value is and where it comes from. As we have seen, both operators have serious limitations.
In contrast, duck typing checks what a value does and provides. After all, you are not interested in the type of a value, you are interested in what you can do with the value.
Duck typing would ask instead: What does the function do with the value? Then check whether the value fulfills the needs, and be done with it.
This check is not as strict as
instanceof, and that is an advantage. A function that does not assert types but object capabilities is more flexible.
Array.prototypebut walk and talk like arrays: Arguments, HTMLCollection and NodeList. A function that uses duck typing is able to support all array-like types.