Question 72
Question
Answer
function square(x) { return x * x; }
function addOne(x) { return x + 1; }
const composedFunction = compose(square, addOne); // 'composedFunction' is now our pipeline
console.log(composedFunction(2)); // Output: 9 (because: 2 + 1 = 3, then 3 * 3 = 9)const myElement = document.getElementById('myDiv');
myElement
.style.color = 'red' // Changes the text color to red
.style.fontSize = '20px' // Sets the font size
.classList.add('important'); // Adds a CSS class named "important"
Last updated