Math.pow
уже не работает?const pow = (number, power) => {
if (number === 1 || power === 0) {
return 1;
}
const count = Math.round(Math.abs(power));
let result = number;
for (let index = 0; index < count - 1; index++) {
result *= number;
}
if (power < 0) {
return 1 / result;
} else {
return result;
}
};
console.log(Math.pow(2, 2) === pow(2, 2)); // true
console.log(Math.pow(2, -2) === pow(2, -2)); // true
console.log(Math.pow(2, -3) === pow(2, -3)); // true
console.log(Math.pow(3, -4) === pow(3, -4)); // true
function mynumber(a, b) {
var c = 1;
if (b < 0) {
for (var i = b; i < 0; i++) {
c /= a;
}
} else {
for (var i = 1; i <= b; i++) {
c *= a;
}
}
return c;
}
const result = arr1.map((n, i) => {
const index = Math.min(i * 2, ((arr2.length - 2) / 2 | 0) * 2);
return `name: ${n} val1: ${arr2[index]} val2: ${arr2[index + 1]}`;
});
result.forEach(alert);
($(element) as any).keydown(e => {
const {
target: {
selectionStart,
selectionEnd
},
keyCode: direction
} = e;
const htmlNode = $(this);
const inputValue = htmlNode.val();
const splittedTime = splitTime(inputValue);
const selectedValue = inputValue.substring(selectionStart, selectionEnd);
if (!selectedValue) { return; }
const Point = (x, y) => ({x, y});
const points = [Point(0, 2), Point(3, 5), Point(6, 10)];
const targetPoint = Point(selectionStart, selectionEnd);
const LEFT = 37;
const UP = 38;
const RIGHT = 39;
const DOWN = 40;
if ((direction === LEFT) || (direction === RIGHT)) {
e.preventDefault();
const index = points.findIndex(p => ((p.x === targetPoint.x) && (p.y === targetPoint.y)));
if (index === -1) { return; }
index += ((direction === LEFT) ? points.length : 1);
points.push(targetPoint);
const point = points[index % points.length];
this.setSelectionRange(point.x, point.y);
}
if ((direction === DOWN) || (direction === UP)) {
e.preventDefault();
const Actions = Enums.ValueActions;
const action = ((direction === DOWN) ? Actions.decrement : Actions. increment);
changeAppendix(splittedTime, selectedValue, htmlNode);
adjustTime(splittedTime, htmlNode, action, selectionStart, selectedValue);
this.setSelectionRange(selectionStart, selectionEnd);
}
});
while 1 == 1:
while True:
directory_copy = 'C:\\Users\\MinuteX\\Downloads\\This is a server of MC\\fantasy_city' #Вписать директория откуда копировать папку ||| ВАЖНО!!! С ДВОЙНЫМ СЛЕШОМ
directory = 'C:\\Users\\MinuteX\\Downloads\\Safe' #Впмсать директорию куда будут копироватся файлы, ||| ВАЖНО!!! ВСЕ СЛЕШЫ ДОЛЖНЫ БЫТЬ ДВОЙНЫМИ
v_DIR = directory + '\\' + new_name + "_" + dt
destination_file = os.path.join(
DESTINATION_DIR,
f'backup_{i}_{datetime.today().strftime("%Y-%m-%d-%H.%M.%S")}',
)
directory_copy = ...
directory = ...
const obj = arr.find(n => n.id === newObj.id);
if (obj) {
obj.counter++;
} else {
arr.push({ ...newObj, counter: 1 });
}
И так как я особо не знаком с UI UX