6. I.D., Please


#1

i don't know what's wrong with it?


#2

@blogsolver,
In this lesson they want to make acquainted
with the typeof-operator
= https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Operators/typeof
with which you can check
the Datatype of the associated Value of a variable

== assigning a string Value to the variable myVar ==
var myVar = "This is a string";
and with the typeof-operator
you are able to acknowledge the Data-type
console.log( typeof myVar ); =>output==> string


#3

Hi!

I had to think about this for a while. First i tried this:

// 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"

And when that didn't work, I ended up with this, which worked:

// 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"

#4

Thanks @urtek n Sir @leonhard_wettengmx_n :smile:


#5

Big Mistake in my opinion. Paranthesis are important always


#6

Here is the code that worked for me:

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

hope that helps.