JavaScript
- 203 ответа
- 0 вопросов
179
Вклад в тег
// ==UserScript==
// @name multiup
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://multiup.org/en/mirror/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(() => {
$('form').on('submit', function(e) {
e.preventDefault();
console.log('click')
window.location.href = $(this).find('button').attr('link');
})
})
})();
function calculateFoodOrder(numAnimals = 0, avgFood = 0) {
if(Number.isInteger(numAnimals) && Number.isInteger(avgFood) && numAnimals > 0 && avgFood > 0 ) {
return numAnimals * avgFood;
}
return -1;
}
const calculateFoodOrder = (n = 0, f = 0) => (Number.isInteger(n) && Number.isInteger(f) && n > 0 && f > 0 ? n * f : -1);
console.log(calculateFoodOrder()); // -1
console.log(calculateFoodOrder(-1,4)); // -1
console.log(calculateFoodOrder(1,3));//3
console.log(calculateFoodOrder([], 200)); // -1
console.log(calculateFoodOrder(Infinity, 200)); // -1