//For multi-line strings- Backtick (``) the key below the esc key on keyboard
long_line=`We are learning Javascript,
and its only the first day`
// Use \ (backslash) to enter a new line
// Boolean is True or False
bool_var="True"
//Date
today=Date("14/02/202")
// or can use today = new Date(1707903741200). toString() to generate the same output
Date.now()
functionf(x){
returnx+1;
}
// in place of the abvove formula we can write this also.. function f(x) {
// var y = x+1;
// return y; }
functionsum(a,b){
returna+b;
}
sum(2,4)
sum("hello","world")
sumshort=(a,b)=>a+b
(a,b)=>a+b
prime=[2,3,5,7,11,13]
prime[0]
prime[3]
prime[5]
prime1=[2,3,"helloo",5,7,11]
prime1[2]
shortNames=({
india:"IN",
china:"CN",
russia:"RU"
})
shortNames.india
shortNames["india"]
//similar to array
// csv data
sample=`area, sale, profit
north,5,2
south,10,4
east,15,6
west,20,8
central,25,10`
data=d3.csvParse(sample,d3.autotype)
sampleCol=({
})
Plot.plot()
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.