Skip to content

Instantly share code, notes, and snippets.

View zootella's full-sized avatar
🏔️

Kevin Faaborg zootella

🏔️
View GitHub Profile
// ----
var start = new Date();
// ----
var size = 10000;
var a = [];
for (var i = 0; i < size; i++) {
a.push(i);
var newFile = function() {
var state = newState();
function close() {//maybe state.close = function() instead
if (state.already()) { log('already closed'); return; }
};
state.pulse = function() {
// Calculate the average of a number of values as they are produced
var newAverage = function() {
var o = {};
var n = 0; o.n = function() { return n; } // How many values we have, 0 before you add one
var total = 0; o.total = function() { return total; } // The total sum of all the given values
var minimum = 0; o.minimum = function() { return minimum; } // The smallest value we have seen, 0 before we have any values
var maximum = 0; o.maximum = function() { return maximum; } // The largest value we have seen, 0 before we have any values
var recent = 0; o.recent = function() { return recent; } // The most recent value you added, 0 before we have any values
var makePerson = function (name, age) {
var me = {}, my = {};
//members
my.name = name;
my.age = age;
//private methods