Posts

Showing posts with the label whether

javascript : Object.isArray

  javascript : Object .isArray Target: Applicable with any javascript  Object  Variable  that holds array value . Description : When an object holds an array then it return  true  otherwise  undefined . basically it is defined in array prototype. Many time in programming we face a problem that an object variable holds array value or other object structure then it help us. Before writing the code of array manipulation we can check whether a variable holds array value or not. Note: It is an property of array that is defined in Array Prototype. It is useful to check an object variable is array or any other type. When we check the typeof(object_variable) it return 'object' not 'array'. Syntax: Object .isArray return  true  when object hold's array value otherwise  undefined Usase: var arr = [1,2,3,4,5]; if(arr.isArray){      console.log('Object holds array'); } else{      console.log('Object is not arr...