function initCounter(startValue) {
let counter = startValue;
return function() {
return --counter;
}
}
let count = initCounter(10);
console.log(count()); // 9
console.log(count()); // 8
let x = { a: 1 };
function f(x) {
x.a = x.a - 1;
}
f(x);
console.log(x); // Object { a: 0 }
SELECT DISTINCT
`currency`,
FIRST_VALUE(`price`) OVER (`win` ORDER BY `created_at` DESC) AS `price`,
MAX(`created_at`) OVER `win` AS `created_max`
FROM `course`
WINDOW `win` AS (PARTITION BY `currency`)