Published
Edited
Apr 3, 2020
2 stars
Insert cell
md`# Intro to JavaScript variables`
Insert cell
Insert cell
(function() {
console.log("Greetings and salutations!");
console.log(5);
var cityStats = {
sfPop: 884363,
sfAreaSqMi: 231.89,
sfMotto: "Oro en Paz, Fierro en Guerra"
}
console.log(cityStats.sfMotto);
console.log(5 + 7);
})();
Insert cell
Insert cell
Insert cell
Insert cell
exercise1 = {
// 📝Create your variable on the next line:
// ☢️ Don't edit the stuff below here
console.log(myName);
}
Insert cell
Insert cell
exercise2 = {
var cheese = "Sharp cheddar";
var secret = 42;
var dog = { name_o: "Bingo" };
var truth = true;
var unknown = undefined;
var self_explanatory = function() { return "this is a function" }
console.log("\nExercise 2: types\n");
console.log(typeof cheese);
console.log(typeof secret);
console.log(typeof dog);
console.log(typeof truth);
console.log(typeof unknown);
console.log(typeof self_explanatory);
}
Insert cell
Insert cell
exercise3 = {
// Create your "myName" variable here.

// Create your "myHobby" variable here.

// 🙅‍ Don't edit the stuff below this line
return {myName, myHobby}
}
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