Basic Algorithm Scripting: Boo who

Basic Algorithm Scripting: Boo who
0

#1

Tell us what’s happening:

Your code so far


function booWho(bool) {
  // What is the new fad diet for ghost developers? The Boolean.
  return if (typeof(bool) === boolean) ? true : false;
}

booWho(null);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/boo-who/


#2

add quote marks to the word 'boolean'


#3

My code still not working:


#4

This is the last my code:

function booWho(bool) {
// What is the new fad diet for ghost developers? The Boolean.
return typeof(bool === ‘boolean’) ? true : false;
}

booWho(null);


#5

My code is working with this solution:

function booWho(bool) {
if (typeof bool === ‘boolean’){
return true;
}
else{
return false;
}
}

booWho(null);


#6

You need to close the brackets after bool.
return typeof(bool) == 'boolean' ? true : false;

There are easier ways to check though.
For instance, you could simply: return typeof(bool) === 'boolean'; since you are just returning the exact same value you are checking for.

Finally, be careful with using the appropriate quote mark. I don’t know if something formatted your quote marks, but the fancy ones do not work.

Fancy: ‘boolean’ (doesn’t work)
Ugly: 'boolean' or "boolean" (works)


#7

function booWho(bool) {
// What is the new fad diet for ghost developers? The Boolean.
return typeof bool === ‘boolean’? true:false;
}

console.log(booWho([1, 2, 3]));


#8