IS
const flag = init_amount >= 1000;
if (!flag) alert("Invalid input data");
Size: a a a
IS
const flag = init_amount >= 1000;
if (!flag) alert("Invalid input data");
N
МВ
IS
C
IS
IS
ЮВ
МВ
IS
m#
ИП
dirReduc = (a) => {
let count = {},
r = [];
for (let i = 0; i < a.length; i++) {
if (count[a[i]]) {
count[a[i]]++;
} else {
count[a[i]] = 1;
}
}
if (JSON.stringify(Object.values(count)) === JSON.stringify([1, 1, 1, 1])) {
r = a;
}
if (count.NORTH > count.SOUTH) {
for (let i = 0; i < count.NORTH - count.SOUTH; i++) {
r.unshift("NORTH");
}
}
if (count.EAST < count.WEST) {
for (let i = 0; i < count.WEST - count.EAST; i++) {
r.unshift("WEST");
}
}
if (count.NORTH < count.SOUTH) {
for (let i = 0; i < count.SOUTH - count.NORTH; i++) {
r.unshift("SOUTH");
}
}
if (count.EAST > count.WEST) {
for (let i = 0; i < count.EAST - count.WEST; i++) {
r.unshift("EAST");
}
}
return r;
};
IS
const obj = {
get a() { return this; }
}
m#
N
МВ
IS
МВ
V
C