interfaces/topic_5/example2/script.js

41 lines
654 B
JavaScript

function a7(b) {
return function () {
return b -= 7;
}
}
const a = a7(100)
console.log(a())
console.log(a())
console.log("hello")
function printMap(obj, func) {
return function (...args) {
func.apply(obj, args);
}
}
person = {name: "Вова"}
function logPerson() {
console.log(`${this.name}`)
}
const f = printMap(person, logPerson)
f()
function printNumbers(from, to) {
let timerId = setInterval(function() {
if (from >= to) {
console.log(from)
from -= 1
}
if (from < to) {
clearTimeout(timerId);
}
}, 1000);
}
printNumbers(10, 5)