V
Size: a a a
V
Y
RD
IK
Q
IK
Q
IK
Q
VC
const bonusesCountExamples = [1, 2, 100, 4, 5, 10, 11];
bonusesCountExamples.forEach(prepareBonusText);
function prepareBonusText(bonusCount) {
/*
* если 2 то "бонуса"
* если 10 то "бонусов"
* если 1 то "бонус"
* ... и так далее
* */
}
G~
S
АП
G~
AS
const updateFile = async (dir, fileName, data) => {
const filePath = createPath(dir, fileName);
try {
const fileHandle = await fs.open(filePath, 'r+');
const jsonData = JSON.stringify(data);
fs.writeFile(fileHandle, jsonData)
.catch(console.log)
.finally(fileHandle.close);
} catch (err) { // if file does not exist
throw new Error(err);
}
};
AS
AS
{"firstName":"Albus","lastName":"Dumbledore","phone":"1234567","password":"2decb0f2ac0321608e97708541f0c4faa86e69d0ad7c1dae66ecdcba63b48b35","tosAgreement":true}e}
AS
АП