medium - accepted / - tried
This is an easy problem.
Besides basic types, you need to also handle also commonly used complex data type including
The goal is not to list up all the data types but to show us how to solve the problem when we need to.
The type should be lowercase
detectType(1) // 'number' detectType(new Map()) // 'map' detectType() // 'array' detectType(null) // 'null' // more in judging step
Let's try to solve this problem within 10 minutes.