Published
Edited
Feb 4, 2020
21 forks
Insert cell
Insert cell
Insert cell
function mystery(input) {
var ret = ""
input++
for (var i = 0; i<20; i++)
{
input--
}
while(input>0)
{
ret = ret + (input==true) + " "
input = input-5
}
return ret
}
Insert cell
function mysteryObject() {
var ret = {
name: 'Sammy',
money: -10000,
occupation: 'Student',
mood: 'Sad'
}
if(ret.money > 0) {
ret.mood = 'relieved'
}
else {
ret.mood = 'still sad'
}
ret.getMoney = function() {
this.money = this.money + 1000
return this.money
}
return ret
}
Insert cell
function blackBox(input1, input2) {
var obj = {
name: input1,
isCrazy: input2,
getsLoopyOnFrootLoops: function(cerealBrand) {
if(cerealBrand==='Froot Loops' && this.isCrazy===true)
return true;
return false;
}
}
return obj;
}
Insert cell
Insert cell
{
var orderedNumberList =
{
first: 1,
second: 2,
third: 3,
fourth: 4,
fifth: 5,
sixth: 6,
seventh:7,
eighth: 8,
ninth: 9,
tenth: 10
}
return orderedNumberList;
}
Insert cell
Insert cell
orderedNumberList = [1,2,3,4,5,6,7,8,9,10]
Insert cell
otherArray= [2,1,3,4,5,6,7,8,9,10]
Insert cell
Insert cell
orderedNumberList.indexOf(4);
Insert cell
orderedNumberList[2]
Insert cell
Insert cell
{
var orderedNumberList = [1,2,3,4,5,6,7,8,9,10]
return orderedNumberList[9];
}
Insert cell
Insert cell
wonkyArray = ["bob", -2.5, true, "Solly the Sexy Saxaphone"]
Insert cell
Insert cell
emptyArray = [] //this is how we declare an empty array
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
theirArmy = ["dog1","dog2","dog3","dog4"] //do not change
Insert cell
ourArmy = ["superKitty"] //do not change
Insert cell
Insert cell
allAnimals = ourArmy + theirArmy
Insert cell
Insert cell
allAnimalsII = allAnimals.addDoggo("superDoggo")
Insert cell
Insert cell
allAnimalsIII = allAnimalsII.findIndexOfSuperKitty()
Insert cell
Insert cell
allAnimalsIV = allAnimalsII.removeThatSuperDoggoCuzITypoedHisNameO()
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