Untitled

mail@pastecode.io avatar
unknown
javascript
2 months ago
299 B
1
Indexable
Never
const buffcirc = k => {
    let arr = [];
    let n = 0;
    
    const acquista = persona => {
        if (n < k)
            arr.push(persona);
        else
            arr[n % k] = persona;
        
        n += 1;
    }
    
    const ammessi = () => arr;
    
    return [acquista, ammessi]; 
}
Leave a Comment