

Need some help on Codecademy.com - nicolasme

Hello there, i'm on codecadyme at the JavaScript Quick Guide, but i'm stuck in this one:<p>http://www.codecademy.com/courses/javascript-intro/3#!/exercises/7<p>this is what i have to do:<p>// Example switch statement. typeof returns the type
// of the value as a string. For example, the type of
// a string is 'string', the type of a number is
// 'number', and the type of an object is 'object'.
switch (typeof 'foo') {
  case 'string':
    // some code<p><pre><code>    // If you don't return in the block, you should
    // always have a break afterwards.
    break;
  default:
    //block</code></pre>
}<p>// Write a function that uses switch statements on the
// type of value. If it is a string, return 'str'. If it
// is a number, return 'num'. If it is an object, return
// 'obj'. If it is anything else, return 'other'.<p>and this is what i did :
function detectType(value) {<p>switch (typeof value) {
 case 'string':
    return 'str' ;
}<p>switch (typeof value) {
 case 'number': 
    return 'num';
}<p>switch (typeof value) {
 case 'objet': 
    return 'obj';
}
  default: return "other";
}
  return value;<p>}<p>&#60;/&#62;
I'm a noob, so i don't know whats missing or wrong, would you kind people please help me? thank  you.
======
iKnowKungFoo
A switch statement handles multiple cases. You have a switch statement per
case. Also, you misspelled "object".

[https://developer.mozilla.org/en/JavaScript/Reference/Statem...](https://developer.mozilla.org/en/JavaScript/Reference/Statements/switch)

~~~
nicolasme
Done, it ended like this :

switch (typeof value) { case 'string': return 'str' ;

case 'number': return 'num';

case 'object': return 'obj';

    
    
      default: return "other";

} return value;

}

Thanks a lot :)

