withIt
const numbers = mutableListOf("one", "two", "three");
withIt(numbers, function () {
console.log(`'withIt' is called with argument ${this}`);
console.log(`It contains ${this.length} elements`);
});const numbers = mutableListOf<string>("one", "two", "three");
const firstAndLast = withIt(numbers, function () {
return `The first element is ${this.first()}, the last element is ${this.last()}`
});
console.debug(firstAndLast);Last updated