Lodash教程

Lodash isArrayLike method

语法

_.isArrayLike(value)
Checks if value is array-like. A value is considered array-like if it's not a function and has a value.length that's an integer greater than or equal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.

参数

value (*) − The value to check.

输出

(boolean) − Returns true if value is array-like, else false.

实例

var _ = require('lodash');
console.log(_.isArrayLike([1, 2]));
console.log(_.isArrayLike('abc'));
console.log(_.isArrayLike(_.noop));
Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

输出

true
true
false
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4