что возвращают методы
почему если мы возвращаем в методе up() this, то мы можем не писать заново
ladder.up()
// {step: 1, up: ƒ, down: ƒ, showStep: ƒ} один
ladder.up()
// {step: 2, up: ƒ, down: ƒ, showStep: ƒ} два
setTimeout( () => window.open('https://www.toster.ru', 'targetWindow',
`toolbar=no,
location=no,
status=no,
menubar=no,
scrollbars=yes,
resizable=yes,
width=400,
height=400`), 3000)
function fib(n, max){
let arr = [0, 1];
for (let i = 2; i < n + 1; i++){
const current = arr[i - 2] + arr[i -1]
if (current >= max) return arr[arr.length - 1] // последнее которое не больше max
arr.push(arr[i - 2] + arr[i -1])
}
return arr[n]
}
fib(20, 6700)
// 4181
// 20-е число Фиб это 6765, поэтому вернулось 19е
localStorage.setItem('toDo', '["Дело номер один", "Дело номер два"]');
div.innerHTML += responseFromServer
[...div.querySelectorAll('.some-class-name')].forEach(d => d.classList.add('new-class-name'))
data = [
{"name":"Adhi Kot","id":"379","nametype":"Valid","recclass":"EH4","mass":"4239","fall":"Fell","year":"1919-01-01T00:00:00.000","reclat":"32.100000","reclong":"71.800000","geolocation":{"type":"Point","coordinates":[71.8,32.1]}},
{"name":"Adzhi-Bogdo (stone)","id":"390","nametype":"Valid","recclass":"LL3-6","mass":"910","fall":"Fell","year":"1949-01-01T00:00:00.000","reclat":"44.833330","reclong":"95.166670","geolocation":{"type":"Point","coordinates":[95.16667,44.83333]}}
]
const find = (rec, key) => (data.find(v => v.recclass === rec) || {})[key]
find('EH4', 'mass')
// 4239
for ( let i=0; i<100; i++ ){
setTimeout(function(){
info.innerText += i + ', ';
}, i * 200 ); // 0 200 400 600 ...
}