Published unlisted
Edited
Jan 8, 2019
Insert cell
Insert cell
Insert cell
function count(values) {
var count = 0;

data.forEach(function(d) {
count += 1;
});

console.log(count);
}
Insert cell
count
Insert cell
function functionCell(count) { var count1 = 0;

data.forEach(function(d) {
count1 += 1;
});
return count1;
}
Insert cell
function count2(values) {
var count2 = 0;

data.forEach(function(d) {
count2 += 1;
});

return count2;
}
Insert cell
console.log(data.length)
Insert cell
var count3 = 0;

data.forEach(function(d) {
count3 += 1;
});

console.log(count3);
Insert cell
data.forEach(function(d) {
count += 1;
})
Insert cell
{
let count4 = 0;

data.forEach(function(d) {
count4 += 1;
});

return count4;
}
Insert cell
{
var dataObject = {"name":"Carl", "age":"48", "salary":"12300"};
var copyOfData = _.clone(dataObject);
copyOfData.age = +copyOfData.age;
copyOfData.salary = +copyOfData.salary;
console.log(dataObject);
}
Insert cell
{
var count = 0;

data.forEach(function(d) {
// count1 wasn't declared so you got an error -- I think you meant count
count += 1;
});

return count;
}
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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