Public
Edited
May 11, 2023
Insert cell
Insert cell
Insert cell
Insert cell
{
const obj = {
name: "john",
age: 10,
};

obj.age = 12;

return obj;
}
Insert cell
Insert cell
array = [ 1, , ]
Insert cell
{
array.push("12" + 3, 12 + 3, "12" * 3, "12" - 3);

return array;
}
Insert cell
array[1]
Insert cell
Insert cell
{
const array = [1, 2];

const [first, , c = 5, d] = array;

console.log(a, b, c)
}
Insert cell
Insert cell
{
let numberMap = new Map([
[1, 'one'],
[2, 'two'],
[3, 'three'],
]);
console.log(numberMap.get(4));
numberMap.set(4, 'fourth');
numberMap.set(4, 'four');

console.log(numberMap.get(4));
return numberMap;
}
Insert cell
{
let numberMap = new Map([
[1, 'one'],
[2, 'two'],
[3, 'three'],
]);
for (let [key, value] of numberMap) {
key--;
console.log(`${key} = ${value}`);
}

console.log("After change");

numberMap.forEach((value, key) => {
console.log(`${key} = ${value}`);
})
return numberMap
}
Insert cell
Insert cell
Insert cell
{
const Fibonacci = function (n) {
if (n == 1 || n == 2) {
return 1;
}

return Fibonacci(n - 1) + Fibonacci(n - 2);
};

let array = [];

for (let i = 1; i <= 10; i++) {
array.push(Fibonacci(i));
}

return array;
}
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