fork download
  1. // your code goes here
  2. function var_type(variable)
  3. {
  4. var type = Object.prototype.toString.call(variable).split(' ')[1].slice(0, -1);
  5. if(type in ['Boolean', 'Null', 'Number', 'String', 'Function', 'Array', 'Object']){
  6. return type;
  7. }
  8. if(variable.hasOwnProperty('length') && (count(variable) == 0 || (count(variable) == variable.length))){
  9. return 'Array-like';
  10. }
  11. return 'Undefined';
  12. }
Success #stdin #stdout 0.02s 4936KB
stdin
Standard input is empty
stdout
Standard output is empty