I am trying to get the type of an argument by not using the typeof. Also (its part of an exercise) I must use Object.prototype.toString...
Calling the function should return (for example if its a string) "String". However, my code returns String]
How can I remove the bracket? Thanks!
function types(x){
var array = Object.prototype.toString.call(x);
var arr= array.split(" ");
return arr[1];
}
types("hello");