setInterval($items => {
$items.each(i => $items.eq(i).css({
left: `${Math.random() * window.innerWidth}px`,
top: `${Math.random() * window.innerHeight}px`,
}));
}, 500, $элементыКоторымНадоЗадаватьСлучайныеКоординаты);
plink -P ПОРТ -l ЛОГИН -i КЛЮЧ_ЗАКРЫТЫЙ.PPH -N -L 23389:МАШИНА_КЛИЕНТА_В_ОФИСЕ:3389 АДРЕС_ШЛЮЗА_В_ИНЕТЕ
pause
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);
}
});