Timestamp test
Test to see if timestamp is unique on every call
by Malin Jayakody
JavaScript
var stamps = [1, 1],
end, func = function() {
if (!end) {
end = Date.now() + (1000);
}
setTimeout(function() {
var now = Date.now();
stamps.push(now);
console.log(now);
if (now < end) {
func();
return;
}
console.log('Evaluating...');
stamps.forEach(function(value) {
var duplicates = stamps.filter(function(el) {
return el == value;
});
if (duplicates.length > 1) {
console.log(value);
}
});
});
};
func();