Challenge: Array or Not?

This challenge will test your skills in implementing the "prototype.toString" function in JavaScript.

Problem statement #

You have to implement a function check that takes an object obj and checks whether it’s an array or not. It returns true if it is else false.

Input #

An object

Output #

Boolean value-true or false

Sample input #

obj = [0,1,2,5]
obj = "str"

Sample output #

true
false

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.