import{name ofthefunction}from" provide notebook link here"
//Call the function with 2 input values to display the result
//ex: division(2,6)
{varnum1=14;
varnum2=7;
functiondivision(a,b){
returna/b}
division(num1/num2)
}
{varresult=division(14,7)}
functiondivision(a,b){
returna/b;
}
md`#### Reemeber to declare a variable using **"Var"** keyword in inside the brackets{ }`
{letarray=['zero','one','two']}
{letnestedArray=[
['zero',0]
['one',1]
['two',2]
]
}
{functionaccessArray(arr){
returnarr[0][1]
}
}
accessArray(nestedArray)
//Create a Global objects with 2 properties(values) to be displayed in a bar chart
//example 1
{// Create an object with 2 properties and 1 method
//example 2
}
md`### Arrays, Objects with functions`
{//Create an array with Objects inside it
}
{//Object inside an Object
}
{//Create an Object with arrays inside
}
{//Import a slider function from other notebook}
{//Call the function and give it to a bar chart input}
md`## Start to End process with Vega-Lite**`
import{slider}from'@jashkenas/inputs'
viewofsi=slider()
si
alphabet=FileAttachment("alphabet.csv").csv()// about file attachments https://observablehq.com/@observablehq/file-attachments
import{vl}from"@vega/vega-lite-api"
alphabet[0]// what a row of data in `alphabet` looks like
// about viewof https://observablehq.com/@observablehq/a-brief-introduction-to-viewof
viewofsimpleBar=vl.markBar()// Make a bar chart
.data(alphabet)// Using the alphabet data
.encode(
vl.x().fieldO("letter"),// .sort(vl.fieldQ("frequency").order("descending")), // Letters are ordinal on the x-axis
vl.y().fieldQ("frequency").axis({format:"%"})// Frequency on the y-axis, formatted as percent
)
.render()
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.