В
Size: a a a
В
j
В
В
A
public createdTableArr: { dailyCalories: number; id: number; time: string; eating: string }[];
changeValueTimes(value, id): void {
const timeValue = value.target.value;
this.createdTableArr = this.createdTableArr.map((item) => (
item.id === id ? { ...item, time: timeValue } : item
));
}
КГ
changeValueTimes(value, id): void {
const timeValue = value.target.value;
this.createdTableArr = this.createdTableArr
.filter((item) => item.id === id)
.map((item) => ({ ...item, time: timeValue }));
}
КГ
changeValueTimes(value, id): void {
const timeValue = value.target.value;
this.createdTableArr = this.createdTableArr.map((item) => (
item.id === id ? { ...item, time: timeValue } : item
));
}
A
A
A
j
В
const F = function() {
return {
toString: () => F.n++,
}
}
F.n = 1;
console.log(F() + F() * F());
L
L
function* sleep(ms, val) {
return yield new Promise(r => setTimeout(() => r(val), ms))
}
function* test(fl) {
if ( fl ) {
const val = yield* sleep(1000, 'reg')
console.log({ val })
}
return 0
}
function* test2() {
Promise.resolve().then(() => console.log('after'))
console.time('test')
for(let i = 0; i < 1e6; i++) {
yield* test()
}
console.timeEnd('test')
Promise.resolve().then(() => console.log('before sleep'))
const result = yield* test(1)
console.log( {result} )
}
asyncWrapper(test2)
A
L
function* sleep(ms, val) {
return yield new Promise(r => setTimeout(() => r(val), ms))
}
function* test(fl) {
if ( fl ) {
const val = yield* sleep(1000, 'reg')
console.log({ val })
}
return 0
}
function* test2() {
Promise.resolve().then(() => console.log('after'))
console.time('test')
for(let i = 0; i < 1e6; i++) {
yield* test()
}
console.timeEnd('test')
Promise.resolve().then(() => console.log('before sleep'))
const result = yield* test(1)
console.log( {result} )
}
asyncWrapper(test2)
L
function* sleep(ms, val) {
return yield new Promise(r => setTimeout(() => r(val), ms))
}
function* test(fl) {
if ( fl ) {
const val = yield* sleep(1000, 'reg')
console.log({ val })
}
return 0
}
function* test2() {
Promise.resolve().then(() => console.log('after'))
console.time('test')
for(let i = 0; i < 1e6; i++) {
yield* test()
}
console.timeEnd('test')
Promise.resolve().then(() => console.log('before sleep'))
const result = yield* test(1)
console.log( {result} )
}
asyncWrapper(test2)
L
function* sleep(ms, val) {
return yield new Promise(r => setTimeout(() => r(val), ms))
}
function* test(fl) {
if ( fl ) {
const val = yield* sleep(1000, 'reg')
console.log({ val })
}
return 0
}
function* test2() {
Promise.resolve().then(() => console.log('after'))
console.time('test')
for(let i = 0; i < 1e6; i++) {
yield* test()
}
console.timeEnd('test')
Promise.resolve().then(() => console.log('before sleep'))
const result = yield* test(1)
console.log( {result} )
}
asyncWrapper(test2)
L