Published
Edited
Jan 27, 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 !!bob//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' ||
color === '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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more