var nums = 123123;
var arr = `${nums}`.split('');
var result1 = 0;
var result2 = 0;
arr.forEach((curr, index) => {
(index <= 2) ? result1 += Number(curr) : result2 += Number(curr);
})
console.log((result1 == result2) ? 'сумма первых цифр равняется остальным трем' : 'нет, не равняется')
const setProtection = (name = '', style = '', icon = '') => ({ name, style, icon });
есть какая-то конкретная киллер-фича?как минимум он готов для работы прямо из коробки.
Math.max() возвращает 0, если в массиве нет положительных чисел.
Math.max(1, 2, 3) // 3
Math.max(-78, -20, -10) // -10
Math.max(...[1,2,3]) // 3
Math.max.apply(null, [-78, -20, -10]) // -10
const map = {
n: "account_name",
d: "start_deposit",
c: "client_name",
b: "ib_account_number",
l: "leverage",
e: "description",
r: "rebalance_model",
m: "model_settings",
s: "selected_systems",
w: "target_weights",
}
let key = "ndcbler";
const hasSettings = this.newAccount.model_settings !== "{}";
const hasWeights = this.newAccount.target_weights !== "{}";
if (hasSettings && hasWeights) {
key += "swm";
} else if (hasSettings) {
key += "m";
} else if (hasWeights) {
key += "sw";
// } else { // что делаем, если ни того ни того нет?
// key = "";
}
this.objForPost = key.split("")
.map((key) => `-${key} ${this.newAccount[map[key]]}`)
.join(" ");
придумали ли программисты в PHP