Arrays

Array Type Check

Array Type Check

Arrays are objects in JavaScript, so a broad object check cannot tell you whether a value is really a list. Strings and object-like values can also have a length property, which makes length checks unreliable for validation.

When code receives unknown data from a form, URL, or API response, it often needs to confirm that a value is an array before treating it like a list.

Your task: Complete isListPayload so it returns true only when value is an array. Return false for strings, plain objects, null, and any other non-array value.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Array Type Check

Arrays are objects in JavaScript, so a broad object check cannot tell you whether a value is really a list. Strings and object-like values can also have a length property, which makes length checks unreliable for validation.

When code receives unknown data from a form, URL, or API response, it often needs to confirm that a value is an array before treating it like a list.

Your task: Complete isListPayload so it returns true only when value is an array. Return false for strings, plain objects, null, and any other non-array value.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.