Published
Edited
Jan 18, 2020
Insert cell
Insert cell
Insert cell
//Answer Checker
Insert cell
Insert cell
{
var accountBalance = 254.35
var customerName = 'The Dude'
var welcomeMessage = 'Hello, ' + customerName + '! Your current balance is ' + accountBalance
return welcomeMessage
}
Insert cell
Insert cell
25 < 2 //notice that these operators take two numbers and output a boolean
Insert cell
25 > 2
Insert cell
2 <= 2
Insert cell
3 >= 2
Insert cell
Insert cell
3 == 3
Insert cell
3 === 3
Insert cell
3 == 2
Insert cell
3 === 2
Insert cell
3 != 2
Insert cell
3 != 3
Insert cell
Insert cell
true + true
Insert cell
+null == 0
Insert cell
"3" + 1
Insert cell
"3" - - 1
Insert cell
1 + + "3"
Insert cell
false == ""
Insert cell
!""
Insert cell
Insert cell
Insert cell
Insert cell
!!0 // 0 is falsy
Insert cell
!!null // null is falsy
Insert cell
!!undefined // undefined is falsey
Insert cell
!!"" // an empty string is falsy
Insert cell
!!123 // numbers other than 0 are truthy
Insert cell
!!"this is a string" // non-empty strings are truthy
Insert cell
Insert cell
Insert cell
"" == false
Insert cell
0 == false
Insert cell
"foobar" == true
Insert cell
"1" == 1
Insert cell
0 == "0"
Insert cell
undefined == null
Insert cell
Insert cell
"" === false
Insert cell
0 === false
Insert cell
"foobar" === true
Insert cell
"1" === 1
Insert cell
0 === "0"
Insert cell
undefined === null
Insert cell
Insert cell
Insert cell
Insert cell
function truthyIzer(bob)
{
return //Write your code here
}
Insert cell
Insert cell
Insert cell
function colorPicker(color) {
//It's OK that the code below spans multiple lines - Javascript reads it all as one line.
//The code just covers multiple lines so that we humans can read it better :)
return true &&
color === 'purple' ||
color == 'green' ||
color === ('blue' || 'Blue') ||
color != 'aquamarine' ||
color === 'red' &&
color > ""
}
//Psst... If you want hints on what isn't working in your code, look at the error messages below!
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more