1、问题背景 不同数据类型对象变量,如何判断一个对象是否为Buffer对象2、实现源码> you='anikdjfijkfjkdsjfkdjfkdjfkdjfkdjfkd';'anikdjfijkfjkdsjfkdjfkdjfkdjfkdjfkd'> hai=Buffer(128);<Buffer
> you='anikdjfijkfjkdsjfkdjfkdjfkdjfkdjfkd';
'anikdjfijkfjkdsjfkdjfkdjfkdjfkdjfkd'
> hai=Buffer(128);
<Buffer 90 a4 3d 00 00 00 00 00 c0 c5 3b 00 00 00 00 00 e0 93 3c 00 00 00 00 00
0a 00 00 00 00 00 00 00 08 94 3c 00 00 00 00 00 05 00 00 00 01 00 00 00 00 00 ..
. >
> typeof(you);
'string'
> typeof(hai);
'object'
> Buffer.isBuffer(you);
false
> Buffer.isBuffer(hai);
true
>
3、问题说明