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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more