Size: a a a

2020 June 21

DE

Denis Efremov in pro.js
Выкинь её нахуй
источник

AK

ARTUR KNYAZEV in pro.js
для опыта )) интересно стало
источник

AK

ARTUR KNYAZEV in pro.js
Denis Efremov
Выкинь её нахуй
с ним плохо ?
источник

DE

Denis Efremov in pro.js
ARTUR KNYAZEV
с ним плохо ?
Да
источник

DE

Denis Efremov in pro.js
Почему ты не учишь санскрит или персидский?
источник

AK

ARTUR KNYAZEV in pro.js
на скрость влияет или что ?
источник

DE

Denis Efremov in pro.js
ARTUR KNYAZEV
на скрость влияет или что ?
На всё влияет
источник

AK

ARTUR KNYAZEV in pro.js
Denis Efremov
Почему ты не учишь санскрит или персидский?
это что такое
источник

DE

Denis Efremov in pro.js
ARTUR KNYAZEV
на скрость влияет или что ?
Скорость хуже, код неявный, ты становишься говнарем, зп не растет
источник

AK

ARTUR KNYAZEV in pro.js
аааа)) понял
источник

DE

Denis Efremov in pro.js
ARTUR KNYAZEV
это что такое
Это типа фреймворков
источник

p

persona x grata in pro.js
Create a function cycleIterator that accepts an array, and returns a function. The returned function will accept zero arguments. When first invoked, the returned function will return the first element of the array. When invoked a second time, the returned function will return the second element of the array, and so forth. After returning the last element of the array, the next invocation will return the first element of the array again, and continue on with the second after that, and so forth.


function cycleIterator (arr) {
 let count = 0;
 return function inner () {
   if(count > arr.length - 1) {
     count = 0;
   }
   count += 1;  
   return arr[count - 1];      
 }
}

const threeDayWeekend = ['Fri', 'Sat', 'Sun'];
const getDay = cycleIterator(threeDayWeekend);
console.log(getDay()); // should log: 'Fri'
console.log(getDay()); // should log: 'Sat'
console.log(getDay()); // should log: 'Sun'
console.log(getDay()); // should log: 'Fri'
источник

S

Syntax Highlight Bot in pro.js
persona x grata
Create a function cycleIterator that accepts an array, and returns a function. The returned function will accept zero arguments. When first invoked, the returned function will return the first element of the array. When invoked a second time, the returned function will return the second element of the array, and so forth. After returning the last element of the array, the next invocation will return the first element of the array again, and continue on with the second after that, and so forth.


function cycleIterator (arr) {
 let count = 0;
 return function inner () {
   if(count > arr.length - 1) {
     count = 0;
   }
   count += 1;  
   return arr[count - 1];      
 }
}

const threeDayWeekend = ['Fri', 'Sat', 'Sun'];
const getDay = cycleIterator(threeDayWeekend);
console.log(getDay()); // should log: 'Fri'
console.log(getDay()); // should log: 'Sat'
console.log(getDay()); // should log: 'Sun'
console.log(getDay()); // should log: 'Fri'
источник

p

persona x grata in pro.js
как решить лучше?
источник

L

Lupusregina[beta] in pro.js
persona x grata
как решить лучше?
const cycleIterator = (arr, i = 0) => () => arr[i++ % arr.length]
источник

DE

Denis Efremov in pro.js
Lupusregina[beta]
const cycleIterator = (arr, i = 0) => () => arr[i++ % arr.length]
А можно стандартный итератор так зациклить?
источник

L

Lupusregina[beta] in pro.js
Denis Efremov
А можно стандартный итератор так зациклить?
да
источник

p

persona x grata in pro.js
Lupusregina[beta]
const cycleIterator = (arr, i = 0) => () => arr[i++ % arr.length]
четко
источник

L

Lupusregina[beta] in pro.js
Denis Efremov
А можно стандартный итератор так зациклить?
function* cycleIterator(a) {
 while(1)
   for(const v of a)
     yield v
}

const sleep = m => new Promise(r => setTimeout(r, m))

for(const v of cycleIterator([1,2,3])) {
 console.log({ v })
 await sleep(1e3)
}
источник

S

Syntax Highlight Bot in pro.js
Lupusregina[beta]
function* cycleIterator(a) {
 while(1)
   for(const v of a)
     yield v
}

const sleep = m => new Promise(r => setTimeout(r, m))

for(const v of cycleIterator([1,2,3])) {
 console.log({ v })
 await sleep(1e3)
}
источник