import { caching } from'../decorator/caching.js';// binomial combinationsfunction_c(m, n) {if (m - n <0|| n <0) return0;if (m - n ===0|| n ===0) return1;return_c(m -1, n -1) +_c(m -1, n);}// give 'memory' to function '_c'exportconstc=caching(_c);
caching decorator
// โญ๏ธ caching decorator// use a closure to ecapsulate 'f'exportfunctioncaching(f) {// make a new cache for this 'f'let cache =newMap();// returns a function that can rememberreturnfunction (