returnproductOfTwoVariables// <-- ignore that return. it's to make the notebook work
}
functioncookPizza(rawPizza){
return"cooked "+rawPizza
}
cookPizza("mushroom pizza")
cookPizza("wings")
typeoffunctionbob(){}
{
varbob=function(){return"Hi, I'm in Bob!"}
varjoe=bob()+" And now I'm called by Joe!"
returnjoe
}
{
varexampleObject={
name:'example',
func:function(){
return"hi!"
}
}
returnexampleObject
}
{
varbob={
name:'bobz',
hangry:false,
eat:function(){
returnhangry;
}
}
returnbob.eat()
}
{
varbob={
name:"Bob",
emotion:"Hangry",
eat:function(){
this.emotion="Full"
}}
bob.eat()
returnbob.emotion
}
thisOutOfContext=function(){
// what could `this` be?
returnthis;
}
{
vardoggo={
bark:function(){
returnthis.sound
},
sound:'wooof!'
}
vardoggoII={
bark:doggo.bark,
sound:'not wooof!'
}
returndoggo.bark()
}
functionjerry(){
return{
//debug starting here
name:'Jerry'
superpower='intelligence'
powerScore:22
getPower:function(){
returnpowerScore
}
powerUp:function(){
powerScore=powerScore+20
}
setPower:function(score){
powerScore=score
}
favoriteFood:function(){
if(powerScore>50){
return'chz'
}
else{
return'mousetrap chz'
}
}
}
//debug ending here
}
functionsuperCat(){
varsuperCat=
{
//write code here
}
returnsuperCat;
}
superDoggo=function()
{
varsuperDog=
{
//Write Code here
}
returnsuperDog
}
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.