function toRowType (value) { const _toString = Object.prototype.toString; return _toString.call(value).slice(8, -1); } console.log(toRowType(null)); console.log(toRowType({x:1})); console.log(toRowType([1,2,3,4])); console.log(toRowType(/123/)); console.log(toRowType());