Menu

gitpiper

isArrayLike javascript Code Snippet in 2024

typearrayintermediate

Last Updated: 20 April 2024

Checks if the provided argument is array-like (i.e. is iterable).

  • Check if the provided argument is not null and that its Symbol.iterator property is a function.
const isArrayLike = obj => obj != null && typeof obj[Symbol.iterator] === 'function';
isArrayLike([1, 2, 3]); // true isArrayLike(document.querySelectorAll('.className')); // true isArrayLike('abc'); // true isArrayLike(null); // false

javascript snippet similar to isArrayLike For You in April 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️