I.D Please


#1


Lesson 6 I.D. Please:

I get an error saying the console.log statements aren't correct yet the output matches what the lesson requires.


// complete these definitions so that they will have
// the appropriate types
var anObj = { job: "I'm an object!" };
var aNumber = 42;
var aString = "I'm a string!";

console.log(anObj["job"]); // should print "object"
console.log(aNumber); // should print "number"
console.log(aString); // should print "string"


#2

The exercise says that you should print the type of variables used . In javascript we do this using the 'typeof' keyword. Below is the full code.

// complete these definitions so that they will have
// the appropriate types
var anObj = { job: "I'm an object!" };
var aNumber = 42;
var aString = "I'm a string!";

console.log(typeof anObj); // should print "object"
console.log(typeof aNumber); // should print "number"
console.log(typeof aString); // should print "string"

hope that helps...


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.